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 -N install python38
sudo port select --set python python38
sudo port -N install py38-gnureadline
sudo port -N install py38-tkinter
sudo port -N install py38-numpy
sudo port -N install py38-scipy
sudo port -N install py38-matplotlib
sudo port -N install py38-astropy
sudo port -N install py38-pandas
sudo port -N install py38-cython
sudo port select --set cython cython38
sudo port -N install py38-statsmodels
sudo port -N install py38-lockfile
sudo port -N install py38-dill
sudo port -N install py38-pip
sudo port select --set pip pip38
  • Optionally, install libraries that might be useful when working with python:
sudo port -N install py38-ipython
sudo port select --set ipython py38-ipython
sudo port -N install py38-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
PATH=/usr/bin:$PATH make turbospectrum
PATH=/usr/bin:$PATH make moog