Installing HEASoft - Mac

Instructions for Source Code

    • Installations from the source code are generally recommended over the pre-compiled binaries (currently unavailable in any case) to avoid any potential portability issues. Note also that source code builds are required for users who wish to load local models in Xspec or use the Xspec Python interface (PyXspec).

      The instructions below assume that you have already
      downloaded and unpacked a HEASoft source code tar file.

      Previous HEASoft releases required use of the Rosetta binary translation utility on Apple Silicon hardware, but HEASoft 6.31 lifts this restriction and supports builds on the native arm64 architecture.

    • Prerequisites:

      In order to build HEASoft from the source code distribution, you will need some additional software:

      • X11:

        We recommend XQuartz but X11 is also available via the various Mac package managers.

      • Compilers: C, C++, Perl & Fortran:

        The HEASoft 6.31 release restores support for the Apple XCode C compilers (/usr/bin/clang,clang++,perl), and we recommend using these:

        • Apple XCode: To get the Apple XCode compilers, install the Command Line Tools (CLT) and make sure that they are up-to-date with your OS:
            % xcode-select --install
          Having out-of-date CLT can result in malfunctions in third-party software such as the Fortran compiler.

        • A Fortran compiler: Fortran compilers are available via package managers such as Homebrew or MacPorts. These two are the ones primarily tested at the HEASARC and are recommended above other options. Note that when updating your Mac OS or XCode version, it is typically necessary to reinstall these third-party packages for compatibility with the new system.

          For example, install gfortran from the Homebrew gcc@12 package:
              % brew install gcc@12
              This provides /usr/local/bin/gfortran-12 (Intel) or /opt/homebrew/bin/gfortran-12 (Silicon)

          Or, install gfortran from the MacPorts gcc12 package:

              % sudo port install gcc12
              This provides /opt/local/bin/gfortran-mp-12 (Intel or Silicon)
      • Python:

        Python is required if you wish to use the Python tools and interfaces in HEASoft (includes IXPE tools, HEASoftPy, PyXspec, and HEASP. The IXPE tools and HEASoftPy require Python 3.7 (or newer), as well as pip, AstroPy (v4.0.0 or newer), NumPy (v1.7.0 or newer), and SciPy (v1.6.0 or newer).

        We recommend using Anaconda / Miniconda to install Python 3 and the requisite packages in for example your home directory:

          % conda install astropy numpy scipy pip
         In Bourne shell variants (bash/sh/zsh):         In C-shell variants (tcsh/csh):
          % export PYTHON=$HOME/miniconda3/bin/python3   % setenv PYTHON $HOME/miniconda3/bin/python3

    • Configuring, building, and installing the software:

      After installing the prerequisite packages above, most users should just follow the basic GNU-like build procedure detailed in the HEASoft installation guide and outlined here:

      First - as described above - make sure that the configure script will choose the correct set of compatible compilers for the build, for example:

       In Bourne shell variants (bash/sh/zsh):         In C-shell variants (tcsh/csh):
          % export CC=/usr/bin/clang                     % setenv CC /usr/bin/clang
          % export CXX=/usr/bin/clang++                  % setenv CXX /usr/bin/clang++
          % export PERL=/usr/bin/perl                    % setenv PERL /usr/bin/perl
          % export FC=/opt/homebrew/bin/gfortran-12      % setenv FC /opt/homebrew/bin/gfortran-12
          % export PYTHON=$HOME/miniconda3/bin/python3   % setenv PYTHON $HOME/miniconda3/bin/python3
      Mac users are advised to put /usr/bin ahead of other paths (such as those used by MacPorts, Anaconda, etc.) in their PATH in order to avoid potential errors.
          % export PATH="/usr/bin:$PATH"                 % setenv PATH="/usr/bin:$PATH"
      External packages (e.g. Anaconda) may set compiler or other flags in the environment which can break a HEASoft build, so users are also advised to unset all "FLAGS" variables:
          % unset CFLAGS CXXFLAGS FFLAGS LDFLAGS build_alias   % unsetenv *FLAGS build_alias
      Next, configure, build, and install the software. Note that you should commit to the location of the software prior to running the configure script. Once you have built the software, library paths are hard-coded into the executables, and they will not function correctly if relocated.
       In Bourne shell variants (bash/sh/zsh):      In C-shell variants (tcsh/csh):
          % cd heasoft-6.31/BUILD_DIR/              % cd heasoft-6.31/BUILD_DIR/
          % ./configure > config.txt 2>&1               % ./configure >& config.txt
          % make > build.log 2>&1                       % make >& build.log
          % make install > install.log 2>&1             % make install >& install.log
      Note that you should let each step finish before proceeding to the next. The installation guide contains descriptions of optional configuration flags that more advanced users may wish to utilize.

    • Lastly, please also note that the compiler settings described above will NOT pass to a sudo shell, so if you want to install HEASoft in a location which requires su write privileges, we recommend that you configure and build the software in a location writeable by you, and only when doing the final install step should you use sudo. Here is an example in which a user has already set compiler variables as described above and acquired the source code tar file, which is sitting in their Downloads/ directory; they then unpack, configure and build the HEASoft source code in their home directory and then install under /usr/local/heasoft-6.31:
          % cd ~
          % tar zxf Downloads/heasoft-6.31src.tar.gz
          % cd heasoft-6.31/BUILD_DIR/
          % ./configure --prefix=/usr/local/heasoft-6.31
          % make
          % sudo make install

    • Initialization:

      To initialize the software, do the following:
         For users of Bourne Shell (sh, ash, ksh, bash, zsh):
          % export HEADAS=/path/to/your/installed/heasoft-6.31/(PLATFORM)
          % source $HEADAS/
         For users of C Shell variants (csh, tcsh):
          % setenv HEADAS /path/to/your/installed/heasoft-6.31/(PLATFORM)
          % source $HEADAS/headas-init.csh
      In the examples above, (PLATFORM) is a placeholder for the platform- specific string denoting your machine's architecture, for example:



    If FTOOLS has been useful in your research, please reference this site ( and use the ASCL reference for HEASoft [ascl:1408.004] or the ASCL reference for the original FTOOLs paper [ascl:9912.002]:

    Blackburn, J. K. 1995, in ASP Conf. Ser., Vol. 77, Astronomical Data Analysis Software and Systems IV, ed. R. A. Shaw, H. E. Payne, and J. J. E. Hayes (San Francisco: ASP), 367.

    Web page maintained by: Bryan K. Irby

    HEASARC Home | Observatories | Archive | Calibration | Software | Tools | Students/Teachers/Public

    Last modified: Thursday, 17-Nov-2022 16:31:50 EST