MacPython and Gnuplot in MacOS X
These instructions are for MacOS 10.2 (Jaguar) and as of
September 2004 are out of date. They will likely need to
be modified to work with more recent versions of the packages below.
for MacOS 10.3 (Panther), including SciPy, are
Scientific use of Python requires at a minimum Numerical Python and
a simple way to generate plots. There are several ways to do this
under MacOS X. Here I describe a simple approach using MacPython
You can instead use the Unix versions of Python and many other programs.
This is actually easier than what I describe below, as long as you
the Fink project.
However this approach requires extensive downloads,
including all of X-windows. On the other hand, it makes the entire
world of open-source Unix software available to you, so it may well
be worth the download time. On the other other hand, MacPython is
is a very elegant Mac-centric program.
So here instead is a relatively small set of downloads which gives
a functioning Python (MacPython), a nice development environment (PythonIDE),
Numerical Python, and plotting (using Gnuplot). Pretty much everything
I want except for Scipy. The following instructions use the terminal
application, which is located in /Applications/Utilities.
- Download MacPython
a version that worked for me in case something breaks in a later release.
Get it here.)
The download is a disk image which is mounted on your desktop. Open it
and double-click the pkg file to install.
- You may need to change some file ownerships before continuing.
sudo chown USERNAME /Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages
(all one line regardless of how it appears in your browser)
in a terminal window. Here USERNAME is your user name.
- Open the MacPython folder in your Applications folder
and start PythonIDE, a nice Python development environment. Select
File->PackageManager. Select Numeric-22.0-binary, uncheck the box
"For current user only" and click Install.
- Download Gnuplot.
(I downloaded a version which is available here.)
Open a terminal window and change directory ("cd") to wherever you downloaded. Then issue the commands
This installs gnuplot in /usr/local/bin.
sudo pax -rf gnuplot_binaries.pax
- Download gnuplot.py.
(I downloaded a version which is available
Open a terminal window and change directory ("cd") to wherever you downloaded.
Then issue the commands
gunzip gnuplot-py-1.6-1.tar (if the file was not uncompressed during download)
tar -xf gnuplot-py-1.6-1.tar (if the file was not untarred during download)
/usr/local/bin/python setup.py install
- You need to fix one file which this installs. In a terminal change
directory by issuing the command
Edit the file gp_macosx.py (perhaps using "pico gp_macosx.py"), changing the
gnuplot_command = 'gnuplot'
gnuplot_command = '/usr/local/bin/gnuplot'
- Download Aquaterm.
(I downloaded an older version which is available
If necessary navigate to the downloaded file and
issue these commands within a terminal:
gunzip aquaterm-0.3.2.tar (if the file was not uncompressed during download)
Copy or drag the application Aquaterm from folder AQT to your Applications
tar -xf aquaterm-0.3.2.tar (if the file was not untarred during download)
- To test Gnuplot, start PythonIDE. Open the file
The file opens in PythonIDE's script editor. Look at the file to see typical
uses of gnuplot.py. One change is needed. Scroll down, and just after the
g = Gnuplot.Gnuplot(debug=1)
add the following:
g('set terminal aqua') (Indent exactly as the preceding line.)
Click the little black triangle on the upper right edge of the PythonIDE
window that opens, and choose "Run as __main__". Then click "Run all".
Wait a while before clicking "OK".
- The examples in demo.py all plot in the same window.
You can open plots in multiple windows using:
g('set terminal aqua 1')
g('set terminal aqua 2')
M.D. Johnson, August 2003