Rasmus Fonseca

Installing gnuplot on Mac OSX with homebrew

When trying to install gnuplot on Yosemite I got the error 'No available formula for xz (dependency of gnuplot)'. This is odd as there is a brew formula at brewformulas.org/Xz, but here's my solution:

First create a formula:

$ brew create http://tukaani.org/xz/xz-5.0.7.tar.gz --set-version 5.0.7
This opens up an editor with the formula. Edit it so it looks like this:
require "formula"
class Xz < Formula
   homepage "http://tukaani.org/xz/"
   url "http://tukaani.org/xz/xz-5.0.7.tar.gz"
   version "5.0.7"
   sha1 "da6d81015333785fc9399ab129e6f53fe1cbf350"

   depends_on :x11 # if your formula requires any X11/XQuartz components

   def install
      system "./configure", "--disable-debug",
                            "--disable-dependency-tracking",
                            "--disable-silent-rules",
                            "--prefix=#{prefix}"
      system "make", "install" 
   end

   test do
      system "false"
   end
end
Save, quit and run
$ brew install Xz
$ brew link Xz
$ brew install gnuplot --with-x
This worked for me.