Pure on Mac OS X
Pure readily compiles from source on Mac OS X if you have the required tools and libraries on your system. But we really recommend installing it through MacPorts which has an abundance of other ports of Linux/Unix software in its repositories, including all dependencies of Pure and its addon modules. The Pure packages are maintained by Ryan Schmidt who is also one of the MacPorts project managers.
We're dedicated to make the Pure experience on the Mac as complete and pleasant as possible. If you notice anything that's missing or not working properly on the Mac, then please file a ticket on MacPorts' bug tracker (if it's related to an existing port), report the issue on the Pure mailing list, or mail me directly at firstname.lastname@example.org.
Installation via MacPorts
Please check the MacPorts website for information on how to set up MacPorts on your system. To install ports from MacPorts you use the
port install command. This needs to be run as root, via the
sudo command, so that you have the administrator rights necessary to install software on your computer. (Other variants of the
port command can and should be run as an ordinary user, e.g., if you want to retrieve information about the available ports. You can use the terminal application of your Mac to enter these commands in the shell.)
Once you got MacPorts up and running, installing the Pure interpreter and the online documentation should be as simple as:
sudo port install pure pure-docs
Pure is also in MacPorts' binary package repositories, so this will most likely not even need a compilation step. Afterwards try running
pure from the terminal to invoke the interpreter. At the interpreter's prompt, you can type expressions to be evaluated. For instance:
$ pure __ \ | | __| _ \ Pure 0.62 (x86_64-apple-darwin13.2.0) | | | | | __/ Copyright (c) 2008-2014 by Albert Graef .__/ \__,_|_| \___| (Type 'help' for help, 'help copying' _| for license information.) Loaded prelude from /opt/local/lib/pure/prelude.pure. > map (2^) (1..10); [2.0,4.0,8.0,16.0,32.0,64.0,128.0,256.0,512.0,1024.0]
help in the interpreter will fire up the online help. You can also try the examples distributed with Pure which will be installed under
/opt/local/share/examples/pure. To exit the interpreter, type
ctrl+D at the beginning of the interpreter's command line.
If you later decide that Pure is not for you and that you'd like to remove these packages again, you can do that with the
port uninstall command:
sudo port uninstall pure pure-docs
The following commands let you update your MacPorts installation so that you can always have the latest version of Pure and the other ports you have installed on your system:
sudo port selfupdate sudo port upgrade outdated
The first command updates MacPorts' port database (and MacPorts itself if needed). The second command then upgrades any ports for which there are newer versions available in MacPorts (
sudo port selfupdate will tell you when it is time to do so). You can also upgrade specific packages like this:
sudo port upgrade pure pure-docs
Please also check the Using MacPorts section of the MacPorts documentation to find out how to employ the
port program to maintain your MacPorts installation.
MacPorts also offers a complete collection of Pure addon modules which cover a wide range of useful programming utilities and libraries from different categories. Once you have Pure itself up and running, you can install individual addon packages as usual with the
port command. For instance, if you're interested in math and scientific computing then you might want to get Pure's interfaces to the Octave numeric computation language and the Reduce computer algebra system, which can be installed as follows:
sudo port install pure-octave pure-reduce
The available addons are all in MacPorts'
pure category, so you can list them with
port list category:pure, or employ
port info category:pure to show a brief summary of each package. The package descriptions can also be viewed online in MacPorts' package browser. More comprehensive descriptions of the packages can be found in the Pure documentation; you can also view these with the
help command of the Pure interpreter (e.g.,
help pure-octave# will bring up the documentation of the pure-octave module). Examples contained in the packages are available in the corresponding subdirectories of
/opt/local/share/examples after installation.
pure category, you can also just install everything that's available:
sudo port install category:pure
Installing these packages for the first time will pull in quite a few dependencies in the form of other MacPorts packages, so this can take a while. The same command, using
port uninstall in lieu of
port install can be used to remove all addon packages if you no longer need them.
For your convenience, we also offer some additional OS X-specific packages below which will make your life easier when working with Pure on the Mac. These are described below.
Pure and w3m
The MacPorts version of the Pure interpreter has been patched up so that it will display the online help in your default browser application. However, if you prefer to read the documentation in the text-based browser w3m, as described in the Pure manual, just set the
PURE_HELP environment variable to
w3m, and make sure that you have w3m installed on your system (
sudo port install w3m).
Pure and Aquamacs
You might want to consider using Aquamacs, an excellent, free and Mac-friendly (native Aqua) port of Emacs, as an option to edit and run your Pure scripts using Pure's Emacs mode. This provides you with syntax highlighting, online help, and the ability to invoke the Pure interpreter and run entire Pure scripts or individual code snippets directly in Aquamacs. To make it easy to install Pure mode in Aquamacs, we have put together a little package which includes both pure-mode and emacs-w3m: aquamacs-pure-mode-1.1.pkg.
Note: This is an unsigned package, so you may need to override Gatekeeper to allow installation. Instructions on how to do this can be found in the section labeled "How to open an app from a unidentified developer and exempt it from Gatekeeper" on this page.
The package can be installed either in your home directory or system-wide. It plugs into Aquamacs so that Pure mode should be available and enabled right away after installing the package. However, note that the package also requires w3m to read the online help in Aquamacs; this should be installed from MacPorts if you haven't already done so.
Note: Pure mode also provides integration with the Pd computer music application (see below). If you want to use this, you still have to add the following lines to the
site-start.el file (if you installed the pure-mode package in your home directory, you can find this file under
~/Library/Application Support/Aquamacs Emacs/pure-mode/):
;; Enable Pd keybindings and menu. (custom-set-variables '(pure-pd-pure-support t))
Please make sure that you insert these lines right before the line starting with
;; Enable Pure mode in the file, otherwise it won't have any effect. This will add a new Pd menu to the Pure mode menu. More information about this can be found in the pd-pure manual.
Pure and TeXmacs
Pure can be also run as a plugin in the scientific editor TeXmacs, please check our TeXmacs wiki page for details. The plugin also works on Mac OS X, but isn't included in the MacPorts packages right now, so you'll have to install it manually. To make things easier, we have prepared some packages which should help you get up and running quickly on the Mac. Here's what you'll need:
TeXmacs: There's a port for TeXmacs in MacPorts, but at the time of this writing, it's an older version and doesn't compile out of the box. So we recommend going with the ready-made OS X package from the TeXmacs website. At the time of this writing, the OS X package is provided as a disk image TeXmacs-1.99.2.dmg, but please check the link above to make sure that you get the latest version.
texmacs-pure-plugin-macosx.zip: This is a copy of the Pure TeXmacs plugin from the Pure sources. The package contains two folders,
plugins. Just drop these into your
~/.TeXmacsfolder and you should be ready to go. (Note that the version of the plugin provided here has the default Pure library path set to
/opt/local/lib/purewhich matches the default MacPorts installation path. This shouldn't really matter if you have the
pkg-configprogram installed, however, since the plugin will then be able to determine the proper Pure library path on its own.)
We recommend to install the pure-reduce package from MacPorts (
sudo port install pure-reduce). This is optional, but required to make the math output work, and to provide integration with the Reduce computer algebra system.
After finishing the installation, you can fire up TeXmacs and give it a go. If everything was installed properly then you should be able to find some Pure-related items in TeXmacs'
Insert | Session menu. (If the Pure sessions don't show up in the menu then try logging out and back in again. I found that this is sometimes needed to make TeXmacs pick up changes in the plugin configuration.) Create a new document and try the
Insert | Session | Pure command to insert a basic Pure session. The interpreter should start up right inside the TeXmacs document and leave you at its command prompt, where you can start evaluating Pure expressions. More information can be found in TeXmacs' help menu, under
Help | Plug-ins | Pure.
Pd and Friends
Pure has very good support for interfacing with Miller Puckette's Pd, a popular graphical multimedia programming environment and free Max/MSP alternative. A brief overview of these facilities can be found on the Pure Data wiki page. Specifically, the pd-pure package lets you write Pd externals in Pure, and pd-faust provides you with a dynamic Faust module loader for Pd based on pd-pure. There's also a faust2pd script which lets you generate Pd GUI patches from Faust programs.
The above packages are all available in MacPorts (
sudo port install faust2pd pd-faust pd-pure). After installation you'll find the
faust2pd executable in
/opt/local/bin (which will be on your
PATH so that you can run it on the command line), and the Pd externals will be in
There's currently no port for Pd in MacPorts, so you'll have to install one of the available binary Pd distributions for the Mac. Both Miller Puckette's "vanilla" Pd, Christoph Steiner's Pd-Extended and Jonathan Wilkes' Mac port (nick-named "Purr Data") of Ico Bukvic's Pd-l2ork are known to work. (As vanilla Pd comes without any 3rd party externals, and Pd-extended hasn't been updated since 2013, we'd recommend Purr Data, which is relatively new, actively maintained, has all the latest bugfixes, and offers pretty much all of Pd-extended's features and much more. A quick introduction to Purr Data can be found here.)
For 64 bit Intel Macs, you'll need a 64 bit version of Pd, Pd-Extended or Pd-l2ork to use the externals. At the time of this writing, the latest versions can be found here:
These applications normally expect to find their externals on the Pd library path (usually
/Library/Pd for system-wide and
~/Library/Pd for personal installation on the Mac, please see the Pd FAQ for details; for Pd-l2ork the directory is named
Library/Pd-l2ork instead). So you need to tell them where to find the Pure-related externals installed from MacPorts. The easiest way to do this is to just add
/opt/local/lib/pd/extra to the list of search paths in Pd's
A better way, which also makes sure that the help patches in the
pure packages and the helper abstractions under
extra are found without any further ado, is to create symbolic links to these items in your
~/Library/Pd-l2ork folder (which needs to be created if it doesn't exist yet). For vanilla Pd, this can be done from the command line as follows:
mkdir -p ~/Library/Pd ln -s /opt/local/lib/pd/extra/faust ~/Library/Pd ln -s /opt/local/lib/pd/extra/pure* ~/Library/Pd
For Purr Data a.k.a. Pd-l2ork you'll have to substitute
mkdir -p ~/Library/Pd-l2ork ln -s /opt/local/lib/pd/extra/faust ~/Library/Pd-l2ork ln -s /opt/local/lib/pd/extra/pure* ~/Library/Pd-l2ork
Please note that after installation, both pd-pure and pd-faust still need to be activated by adding them to Pd's startup libraries, as described in the pd-pure and pd-faust documentation. The precise steps are slightly different depending on which Pd version you use, but generally you can just go to the
Startup options in the
Preferences dialog and add
faust/pdfaust there, in that order. Another possibility is to add the options
-lib pure -lib faust/pdfaust in the
Startup flags field.
After committing these changes and restarting the Pd application you should see something similar to the following messages in the Pd main window, which indicate that pd-pure and pd-faust were loaded and are ready to go:
pd-pure 0.20 (pure-0.64) (c) 2009-2014 Albert Graef <email@example.com> pd-pure: compiled for pd-0.45 on Sep 25 2014 11:00:40 pd-faust 0.10 (c) 2011-2016 Albert Graef <firstname.lastname@example.org> pd-faust: registered with pd-pure
Opening Pd's help browser from the
Help menu lets you peruse the available examples in the
faust folders which can be found under
/opt/local/lib/pd/extra, or you can just open these folders in Finder and launch the examples from there.
Other related software can be found on my personal Bitbucket page. Some interesting items there are, e.g., the pd-lv2plugin and pd-mdnsbrowser externals, for which you can find Mac binaries in the Downloads sections of these repositories. These externals all require pd-pure to run.
VTK and Gnocl
Pure's Tcl/Tk module (pure-tk) can optionally interface to VTK which allows you to do advanced 3D graphics and scientific visualizations using VTK's Tcl/Tk bindings. There's also an interface to Peter G. Baum's and William J. Giddings' Tcl-Gnome/GTK bridge Gnocl which lets you develop Gnome/GTK applications using pure-tk. You can live without these, but then the Pure VTK and Gnocl examples won't run and you'll miss out on some really powerful extensions of the basic Tcl/Tk interface.
To make VTK and Gnocl work on the Mac, you'll need some Tcl/Tk modules which aren't available in MacPorts right now. (There's a port of VTK 5.x in MacPorts, but it lacks the required Tk modules and thus isn't very useful for VTK development using Tcl/Tk.) These can all be made to work when compiling recent versions of VTK and Gnocl from source, but the process isn't straightforward. The main complication is that VTK needs to be linked against Apple's Tcl/Tk system framework included in OS X (rather than MacPorts' Tcl/Tk version) to make the Tk integration work. Thus, in order to use VTK and Gnocl via Pure's Tcl/Tk interface, you need special versions of pure-tk, Gnocl and VTK which are all linked against the OS X Tcl/Tk system libraries.
Until these become available in MacPorts, we provide 64 bit Intel binaries of pure-tk and the relevant dependencies below. Please note that these libraries have all been built on Mavericks and so they will require a fairly recent OS X version (OS X 10.9.2+ has been tested, earlier OS X versions might or might not work). All binaries are linked against the OS X Tcl/Tk 8.5 system libraries. Gnocl also requires the Gnome and GTK libraries from MacPorts and their dependencies.
The following packages are available:
pure-tk-0.5-macosx-x86_64.zip: This is a version of the pure-tk module linked against the OS X Tcl/Tk 8.5 system libraries. Use this as a drop-in replacement for the pure-tk package from MacPorts. The files in this package go into the Pure library directory at
gnocl-0.9.96-macosx-x86_64.zip: This package contains the Gnocl Tcl module and some useful addon modules (GnoclBuilder, GnoclCanvas and GnoclGconf). They are linked against the OS X Tcl/Tk 8.5 system libraries and the Gnome and GTK libraries from MacPorts (you'll need at least libgnome, libgnomecanvas, libgnomeui, libglade2, libnotify and gconf). The package unzips into
Library/Tcl, so it should be enough to just unzip the package in your home directory to have the package contents installed in the right locations.
vtk-6.1-tcltk-macosx-x86_64.zip: This contains the Tcl/Tk modules from VTK along with all required libraries. They are linked against the OS X Tcl/Tk 8.5 system libraries. Like the Gnocl package, you can simply unzip this package in your home directory to have the files installed in your
Before you use these libraries with the pure-tk module, we recommend checking that the Gnocl and VTK modules can be loaded by the Tcl interpreter. This can be done by running
/usr/bin/tclsh from the command line and entering the following Tcl commands:
package require vtk package require Gnocl package require GnoclBuilder package require GnoclCanvas package require GnoclGconf
(Make sure that you really run this with the system Tcl shell
/usr/bin/tclsh; if you get a bunch of "can't find package" error messages instead then most likely you invoked the wrong Tcl shell.)
If everything works as it should, then these commands should print the package version numbers (6.1 for
vtk, 0.9.96 for
GnoclBuilder, 0.9.95 for
GnoclGconf). If you get a bunch of error messages instead, then most likely some required libraries are missing; check that you have the system Tcl/Tk framework and the MacPorts Gnome/GTK libraries installed. (In addition to the Gnome/GTK libraries from MacPorts you'll need at least Xcode and the XQuartz X server; please consult the MacPorts installation instructions for information on how to get these up and running.)