Install gnuplot in Mac OS X

In this post I will cover how to install gnuplot once your homebrew installation has finished.

Gnuplot is a very handy and powerful plotting program.

Homebrew packages can have a nnumber of diffrent installation options. What’s available can be seen by running the command “brew options package-name”.\

In gnuplot case, type

$ brew options gnuplot

This returns a list of flags that can be added to the installation command

For example, if you wanted to use X11 terminal for your plots, you would run

$ brew install gnuplot –with-x11

Note that, in order to use the x11 terminal, you need to install Xquartz beforehand.

Wx is a slightly more functional terminal that can be installed with

$ brew install gnuplot –with-x11 –with-pdflib-lite –with-cairo –with-wxmac

This command will also install both wx and x1 terminals, as well as the pdf backend.

If you change your mind and need to install gnuplot with different options, you first need remove the previous version  with “brew uninstall gnuplot”)


Install Homebrew in Mac OS X

A fresh installation of Mac OS X (El Capitan in my case) doesn’t come with many tools that are used in science….gnuplot, xmgrace, pylab, gsl, just to name a few.

The installation of Homebrew is the first step (Macport is also a valid alternative, but it will use more space on your Mac). First of all, you need to download Xcode from the App store (it’s free).  When the download is completed, open Xcode and let it install other required components.

Once the installation is completed, open the Terminal application and in the terminal window, simply run the command

$ sudo xcodebuild -license

scroll to the end and type “agree”.

We are finally ready to install homebrew. In the terminal window, type

ruby -e "$(curl -fsSL"

Press return and just follow the instructions on the screen.

After the installation has completed, you can search the catalog of available programs with “brew search”.

For example, to search for the gsl libraries, run

$ brew search gsl

or to install

$ brew install gsl

Once the installation has finished, the gsl libraries are ready to be used.