Anaconda Python 3

One of the easiest ways to install a Python 3 distribution on MacOSX with most of the needed libraries for iSpec is by using Anaconda.

  • Go to the Anaconda Python 3 Distribution site (you can Skip registration), pick Distribution Installer for Mac that corresponds to your Mac CPU (as a rule of thumb, starting 2020 Macs use Apple Silicon and not the Intel Chip), download the Command Line Installer and run it from a terminal (adapt the file name to the downloaded version):
bash Anaconda3-2025.06-0-MacOSX-arm64.sh

Follow the instructions, anaconda will be installed in /home/your_user/anaconda3/ by default. The installer will ask if you want to initialize/modify .bashrc or .bash_profile, select 'yes'. The installer should have added to your .zshrc, .bashrc or .bash_profile files (in your home directory) something like this:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/your_user/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/your_user/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/your_user/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/your_user/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

This will activate anaconda automatically every time you open a terminal.

  • Close all the terminals and open a new one in order to re-load this new setup.

  • Check that python is correctly installed:

which python
python --version

which should show something similar to:

/Users/your_user/anaconda3/bin/python
Python 3.13.5
  • Install a library that does not come by default and that it is needed by iSpec:
conda update conda
conda update --all
conda install lockfile cython
  • Open a terminal, run xcode-select --install, and click the Install button to install the required command line developer tools. Don't worry if you see a message telling you the software cannot be installed because it is not currently available from the Software Update Server. This usually means you already have the latest version installed. Once installed, verify that this version of gcc is the one being executed from your terminal:
which gcc
gcc --version

which should show something similar to:

/usr/bin/gcc
Apple clang version 17.0.0 (clang-1700.0.13.5)
Target: arm64-apple-darwin24.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

If your system already had these tools and it has gone through multiple updates, sometimes it breaks and it is required to fully remove the tools with sudo rm -rf /Library/Developer/CommandLineTools/ and trigger the install again with xcode-select --install.

  • Install the official gfortran binaries, the latest verified version was gfortran 14.2. Once installed, verify that this version of gfortran is the one being executed from your terminal:
which gfortran
gfortran --version

which should show:

/usr/local/bin/gfortran
GNU Fortran (GCC) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Sometimes it is necessary to uninstall previously installed gfortran, for that you can run sudo rm -rf /usr/local/gfortran/ /usr/local/bin/gfortran; sudo pkgutil --forget com.gnu.gfortran and install it again.

  • Finally, download iSpec source code, decompress it and move to $HOME/iSpec/. Open a terminal in the iSpec directory and run:
make clean
make spectrum
make turbospectrum
make moog
make moog-scat