MacPorts offers a reliable way to install a Python distribution on MacOSX with most of the needed libraries for iSpec. However, it is important to know that sometimes the installation can take time because, depending on your operating system version, it might compile all the packages/libraries from source code. On the other hand, MacPorts is completely open source without limiting licenses and it can be used to install other free software apart from python.

MacPorts installation

  • After the installation, if the user's default shell is bash, edit the file $HOME/.bash_profile and verify that the installer has added the following lines:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
  • Close all the terminals and open a new one. If the user's default shell is bash, in order to load the new configuration you can instead execute:
source $HOME/.bash\_profile
  • Update the local ports tree with the ports repository:
sudo port selfupdate
sudo port upgrade outdated
  • Install python framework and several required extra libraries:
sudo port install python27
sudo port select --set python python27
sudo port install py27-readline
sudo port install py27-tkinter
sudo port install py27-numpy
sudo port install py27-scipy
sudo port install py27-matplotlib
sudo port install py27-astropy
sudo port install py27-cython
sudo port select --set cython cython27
sudo port install py27-statsmodels
sudo port install py27-lockfile
sudo port install py27-pip
sudo port select --set pip pip27
sudo pip install sampy
sudo port install gcc6
sudo port select --set gcc mp-gcc6
  • Optionally, install libraries that might be useful when working with python:
sudo port install py27-ipython
sudo port select --set ipython py27-ipython
sudo port install py27-pandas
sudo port install py27-pudb
  • Download iSpec source code, decompress it and move to $HOME/shared. Open a terminal in the iSpec directory and run:
make clean
make spectrum
make turbospectrum
make moog