rmagick on OS X

Some people have complicated ways of installing RMagick on OS X. If I was using Solaris or something I would have to do that, but I’m not.

First, you need DarwinPorts. Just run the package. Then:

rmagick the easy way
sudo port install rb-rmagick

That’s all.

The big benefit to this is that you can uninstall the packages via port uninstall packagename if you need to. Building directly from the tarballs makes it almost impossible to uninstall.

Note, this will, however, install DarwinPorts versions of Ruby, Ruby Gems, etc. See the comments for more details. Rails works great with the DarwinPorts Ruby, though, and in the end it will save you a lot of trouble to switch over.

3 responses

  1. Yes, I ran into problems with the HiveLogic install process (I’ve never had problems with any other install processes) and now I’ve got stuff scattered all over that is in an incomplete build state and I can’t remove from my OS. So, I tried DarwinPorts as described above and it worked great. However, you should let people know that it’ll install everything that is required—that includes a DarwinPorts build of ruby, etc. That’ll require you to use DarwinPorts to install the gems support and you’ll have to re-install all of your gems as they are in a different directory tree as any other build of Ruby(/opt). But the good news is that a) it works, and b) it can all be removed by simply removing the DarwinPorts directory tree. Also, I found that this page lists some DarwinPorts to preinstall for rmagick that are not technically required but are nice to have:


    After installing all of the ports, I was able to run Gruff which is a great test of the build as it uses fonts, etc.

  2. Thanks for the suggestion. I have been using DarwinPorts Ruby for all of my Rails work since I got the Mac and never had any trouble. I updated the article.

    To use the DarwinPorts Ruby instead of the built-in one, you need to add /opt/local/bin to your default PATH environment variable in the file /etc/profile, and restart the terminal (or run source /etc/profile). Also, if you run gem list before you install via DarwinPorts, you will get a list of all your installed gems, which will make it easier to reinstall them after the migration.

    I think that the only dependencies for rmagick that port doesn’t install automatically are ‘libwmf’ and something called ‘gs’.

    You can always use port search whatever to look for an available port, too.

    There may be a problem with the DarwinPorts version of MySQL, but I don’t know for sure.

  3. I could not install rb-rmagick from DarwinPorts, so install ImageMagick and its dependency libraries, and compile RMagick with source code, it could work now.

    PS. I recommend Locomotive with RMagick bundles to Mac rails coder, it’s easy to use.