I have not posted anything here for a long time. It’s hard to start blogging again, so I will write a short tips and tricks series called “Memo“. Today I’m going to talk about two Ruby gems I’m using in all my Ruby on Rails project: mysql and memcached. Every time I try to install or update those gems on Mac OS X following error occurs:
1 2 3 | Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. |
And then I’m googling on how to install these gems. It’s time simplify my life and post commands here.
Installing the ruby mysql gem on Mac OS X and MacPorts
Installing mysql5 from MacPorts:
1 | sudo port install mysql5 |
Now we can install mysql gem:
1 2 3 4 | kpumuk@kpumuk-mbp~: sudo gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5 Building native extensions. This could take a while... Successfully installed mysql-2.7 1 gem installed |
Installing the ruby memcached gem on Mac OS X and MacPorts
First you need to install memcached and libmemcached:
1 | sudo port install memcached libmemcached |
And then memcached gem:
1 2 3 4 | kpumuk@kpumuk-mbp~: sudo env ARCHFLAGS="-arch i386" gem install memcached --no-ri --no-rdoc -- --with-libmemcached-dir=/opt/local Building native extensions. This could take a while... Successfully installed memcached-0.12 1 gem installed |
If you have any questions that could be covered in this series — ask me in comments.
Полезная заметка, однако она не уберегла меня от плясок с бубном вокруг гема memcached… дело в том, что недавно вышла новая версия libmemcached 0.26 и версия гема 0.14… скомпилить их вместе под леопардом никак не получается… пришлось откатится до 0.25 + 0.12