Using the GNU Scientific Library with Xcode

The GNU Scientific Library (GSL) includes convenient use to matrices among other things.  One convenient way to install GSL is using homebrew.  Once installed a quick “brew install gsl” will do the work for you.  To then use GSL with Xcode, do the following:

  1. Create a new Xcode Project
  2. Edit Build Settings
  3. Under “Other Linker Flags” add the following:
    1. -lgsl
    2. -lgslcblas
  4. Under “Header Search Path” add the following:
    1. /usr/local/Cellar/gsl/1.15/include
  5. Under “Library Search Path” add the following:
    1. /usr/local/Cellar/gsl/1.15/lib
  6. Add the appropriate #include to your source files for the GSL library you wish to use.  For example: #include <gsl/gsl_rng.h>
  7. Code and Compile.

I recommend this blog post for more information – particularly if you wish to compile GSL by hand.

Leave a comment


  1. Excellent post – really helpful, thanks!

  2. xCode version? gsl version?