Install gnuplot 5.0.1 on OSX
Asked Answered
J

6

37

I downloaded the source files for gnuplot 5.0.1 (gnuplot-5.0.1.tar.gz) from the source forge page. I also installed the Command Line Tools on my OS X 10.7.5 so that I have gcc and make in the /usr/bin folder.

I followed the installation instructions found in INSTALL.gnu file of the tarball: I ran the configure file and typed make, make check, make install, and make clean. With these commands, gnuplot is located in /usr/local/bin/.

The make check command outputs a lot of lines in the shell before testing many gnuplot scripts. I could actually visualize the plots and I thought "great, it works". So I opened a new terminal shell and typed gnuplot to begin using it (the terminal is automatically set to qt). A simple plot sin(x) fails. Gnuplot returns these messages :

Could not start gnuplot_qt with path "/usr/local/libexec/gnuplot/5.0/gnuplot_qt" 
Could not start gnuplot_qt with path "/usr/local/libexec/gnuplot/5.0/gnuplot_qt" 
Could not connect to gnuplot_qt "" . Starting a new one 
Could not start gnuplot_qt with path "/usr/local/libexec/gnuplot/5.0/gnuplot_qt" 

Warning: slow font initialization  .  .  .  .  .  .  .  .  .
Warning: slow font initialization  .  .  .  .  .  .  .  .  .
Warning: slow font initialization  .  .  .  .  .  .  .  .  .
Warning: slow font initialization  .  .  .  .  .  .  .  .  .

… 

The warning message keeps appearing infinitely if I don't close the terminal.

Jacquetta answered 6/9, 2015 at 8:49 Comment(0)
D
72

To minimise my effort, I tend to use package managers to install command line tools as much as possible.

For OS X I recommend using homebrew. Installing gnuplot with homebrew is as easy as typing: brew install gnuplot

Dysphoria answered 6/9, 2015 at 9:23 Comment(7)
How to know which version of gnuplot this command will install ?Jacquetta
Bij default brew install gnuplot will install the latest version (currently 5.0.1). Typically, there will be different packages (formulae) for different major versions. For instance, if you want to install gnuplot 4, you could use brew install homebrew/versions/gnuplot4 When in doubt, there's always: braumeister.org which shows some details about the packages.Dysphoria
Ok so I have gnuplot 5.0.1 installed with homebrew, but x11 terminal is not available. Which terminal should I use if I need to check my plots before saving them to png or other terminal ?Jacquetta
Eventually, I uninstalled gnuplot and installed it again by specifying x11 terminal : brew uninstall gnuplot && brew install gnuplot --with-x11. This way, opening gnuplot sets the terminal automatically to x11.Jacquetta
@dada, your comment was extremely helpful to get this working. Fortunately I saw it! Thanks again.Vahe
I tried installing "homebrew" using by pasting /usr/bin/ruby -e "$(curl -fsSL raw.githubusercontent.com/Homebrew/install/master/install)" in my terminal window but got "Illegal variable name"Preciosa
brew cask install aquaterm; brew install gnuplot --with-aquaterm is what eventually worked for me. With XQuartz I just got a black screen (Sierra 10.12.6). I still had to quit and restart terminal to get it to work after installation though.Abijah
T
11

The best way to use gnuplot on MacOS is to set it to work with aquaterm as opposed to X11. Here is what I did to do so on both Yosemite and El Capitan MacOS:

  1. First remove all pre installation of gnuplot and aquaterm, if any:
    • Brew uninstall gnuplot
    • Manually delete Aquaterm if you installed it via dmg file previously from your application.
    • If you installed Aquaterm using brew then use brew uninstall aquaterm.

bottomline: You shouldn't have any installation of gnuplot or aquaterm on your system.

  1. Now install aqua term using brew command:
    • brew install Caskroom/cask/aquaterm
  2. Then install gnuplot using follwing command:
    • brew install gnuplot --with-aquaterm --with-qt4
  3. Finally, run following command to create a shortcut of gnuplot in your path
    • ln -s /usr/local/Cellar/gnuplot/5.0.4/bin/gnuplot /usr/local/bin/gnuplot

That is all; just notice that the location of gnuplot might be different if brew has installed a different version of gnuplot.

Now if you run gnuplot in your terminal you should see something like this: the output of gnuplot command

Tacet answered 16/8, 2016 at 15:28 Comment(2)
QT4 no longer appears supported. Use just QT now.: brew install gnuplot --with-aquaterm --with-qtSantana
Aquaterm is not working for me. I just don't see any window of it.Tangier
J
5

Thanks to @irundaia answer plus some Google search, I finally got gnuplot working with my favorite x11 terminal. Here's the workflow: in a terminal type:

brew uninstall gnuplot
brew install gnuplot --with-x11

The first command uninstall a previous gnuplot installed with homebrew. The second command installs gnuplot by specifying the x11 terminal. This way, opening gnuplot sets the terminal automatically to x11, and the warning messages about "gnuplot_qt" and "slow font initialization" disappeared!

Jacquetta answered 8/8, 2017 at 20:11 Comment(0)
F
1

I ran into similar issues while I was testing few algorithms using Octave, so I did the following which resolved the issues.

You can try this, if you already have GNUPLOT installed, please uninstall it using brew uninstall gnuplot.

  • Download Aquaterm from this location.
  • Once download is complete, follow the instructions for the installation
  • Open Aquaterm x.x.x.dmg
  • Double click AquatermInstaller.pkg
  • Follow the installation wizard.
  • Once Aquaterm installation is complete, install gnuplot using the below command

    brew install gnuplot –with-aquaterm —-with-qt4
    

    The above command along with gnu plot installation, also configures the terminal type to aqua, which means you don’t have to run setenv command post installation. To confirm, run the command “gnuplot” in the terminal and at the bottom of the result, you should see “Terminal type set to aqua”.

To verify the installation and configuration, run the below test in Octave:

x = 1:10
y = 1:10
plot(x,y)

that should launch aquaterm along with the graph.

Firearm answered 2/3, 2017 at 3:16 Comment(1)
qt4 is deprecated as a brew option. You need to use: brew install gnuplot --with-aquaterm --with-qt --with-x11Moxa
F
1

If you don't have homebrew installed you can do this:

xcode-select --install && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" && brew install gnuplote

this command will install xcode (necessary for homebrew), homebrew, and, after that, gnuplot.

Flaxseed answered 9/3, 2021 at 10:29 Comment(0)
J
-1

please set below environment parameters correctly.

GNUPLOT_DRIVER_DIR = "/usr/local/libexec/gnuplot/5.2"
GNUPLOT_PS_DIR     = "/usr/local/share/gnuplot/5.2/PostScript"
HELPFILE           = "/usr/local/share/gnuplot/5.2/gnuplot.gih"

for example:

export GNUPLOT_DRIVER_DIR="/home/boris/local/libexec/gnuplot/5.2"
Jerusalem answered 14/7, 2018 at 14:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.