Installing rb-gsl on Snow Leopard

Published on October 18, 2009 by Jesse Storimer

I wanted to try experimenting with SVD recommenders in Ruby (via this fantastic blog post and was having a hell of a time trying to install Ruby’s linalg. When I saw that there was also an example using rb-gsl, I was thrilled because rb-gsl is available from MacPorts. No problem, right? Wrong!

Currently if you try to install rb-gsl form MacPorts (on Snow Leopard) you will get a build error. If you download the latest release of rb-gsl (1.10.3 at the time of this writing) you will get the same build error. It appears to have some code that doesn’t work on Snow Leopard. Here is how I got it installed.

  1. If you haven’t already, install MacPorts for Snow Leopard (
  2. Install the GSL library
    $ sudo port install gsl plotutils
  3. Because of the incompatibility of the current rb-gsl and Snow Leopard, you will have to install from the latest svn checkout.
    $ svn checkout svn://
    $ cd rb-gsl/trunk/rb-gsl
    $ sudo ruby setup.rb config --prefix=/usr/local
  4. Then we need to edit two lines in the generated ext/Makefile
  5. Open up the file for editing and change these two lines to look like this:
    DLDFLAGS = -L.
    LDSHARED = $(CC) -pipe -bundle -undefined dynamic_lookup
  6. Then continue with the build and you should be on your way
    $ sudo ruby setup.rb setup
    $ sudo ruby setup.rb install


If you are installing this lib to test out the example from above then you may want to check out my comment on that article.


Like what you read?

Join 2,000+ Ruby programmers improving their skills with exclusive content about digging deeper with sockets, processes, threads, and more - delivered to your inbox weekly.

I'll never send spam and you can unsubscribe any time.

comments powered by Disqus