Skip to content

Installation on Mac OS X using Macports

petrrr edited this page Feb 11, 2014 · 13 revisions

Installing MacPorts

If you have not already installed MacPorts, you need first do this before installing ObsPy. There are several options to install MacPorts, but I recommend to use the Mac OS X Installer which is probably the standard approach. All authoritative details on installing MacPorts can be found here. Summary of the necessary steps:

  1. Install Xcode from Apple Developer Connection or Mac App Store. The version to install will depend on your OS X version. Note that for recent XCode (notable 4.3 and later) you will need to install the command line tools explicitly.
  2. Accept the License Terms, if Xcode 4 or later was installed. All steps to setup XCode correctly are found on MacPorts' website.
  3. Install MacPorts and add /opt/local/bin & /opt/local/sbin to your path.
  4. I recommend to run sudo port -v selfupdate before you start installing any new ports.

Installing ObsPy

Once MacPorts is correctly deployed on your system, installing ObsPy and all dependencies is as easy as executing the following command:

sudo port install py27-obspy

This will install ObsPy (port py27-obspy) as one of the site-packages of the Python 2.7 interpreter provided by MacPort (port python27). It is a distinct instance of Python and independent of the system's version. All required dependencies are installed automatically. You need to use MacPort's Python interpreter, which is usually located in /opt/local/bin/python2.7, to be able to import the ObsPy package. You can make this Python instance your default by executing:

sudo port select python python27

Hint: MacPorts avoids any changes to your OS X base system, therefore this selection is implemented by creating symbolic links in opt/local/bin. In order to ensure the selection is effective, your search path variable $PATH should be set in a way to give precedence to directory /opt/local/bin.

If for some reason you prefer to install ObsPy against the Python 2.6 interpreter, the corresponding port is py26-obspy. You can have both versions installed at the same time.

Upgrading your ObsPy

When a new version of ObsPy becomes available via Macports, you can use the following sequences to update your Macports based ObsPy installation:

sudo port selfupdate
sudo port upgrade py27-obspy

The old version is only deactivated, so you could switch back in case you find it useful. If you prefer to clean up your system, remove the old version by executing:

sudo port uninstall py27-obspy and inactive