edit · print · PDF

Please note that all the SIEpedia's articles address specific issues or questions raised by IAC users, so they do not attempt to be rigorous or exhaustive, and may or may not be useful or applicable in different or more general contexts.

macOS Catalina and BigSur: 32bit applications are no longer supported on macOS Catalina and BigSur. We suggest that you run IRAF in a Ubuntu virtual machine installed with Multipass. See the webpage Installation of IRAF on macOS with Multipass and Ubuntu for details and installation instructions.

Quick and easy IRAF installation procedure for macOS (up to Mojave)

If you are not keen on installing IRAF through AstroConda, you might try this simple and quick installation method, instead of following the step by step procedure described below. This method is based on a self-extractable tar archive (prepared using the makeself tool) containing the whole IRAF distribution, as installed on my own iMac (it already includes the most important external packages).

  1. Download the self-extractable archive:
    curl ftp://siesoft:siesoft@ftp.iac.es/iraf-2.16.1_macOS.run -o iraf-2.16.1_macOS.run
    (alternatively, download the file with your browser using the "Save Link As ..." or equivalent function; do not click on the link!).
  2. Run the archive
    sudo bash iraf-2.16.1_macOS.run

Now we have IRAF installed inside directory /opt/iraf/iraf/, and all the symlinks created in the appropriate places, in particular the commands ecl, mkiraf, xgterm and others are symlinked in /usr/local/bin.

The command to launch IRAF is ecl, but before doing that please read the Set up IRAF section below about the required set up steps.


When launching xgterm, you might get a "Library not loaded" error message. If so, you can define the following alias (we assume you are using the bash shell):
alias xg="(export DYLD_LIBRARY_PATH=/usr/X11/lib && /usr/local/bin/xgterm -ls -sb)"
and then use xg to launch it (the -ls flag will make the xgterm window a login shell, while -sb will add a scrollbar). You might wish to include the alias definition above in your .bashrc or .bash_profile file.

To change the type or size of the xgterm fonts, add flag -fn <fontname> (for instance, -fn lucidasanstypewriter-18) to the alias. Type xlsfonts to print all available fonts.

Note that you need XQuartz installed for xgterm to work.


DS9 must be downloaded and installed separately: obtain the most recent version from http://ds9.si.edu/site/ (pay attention to the notes in the Twitter widget, and select the .dmg file appropriate for your macOS version; it will install as a macOS Application).


To use IRAF from PyRAF, you need to define the following environment variable:
export iraf="/opt/iraf/iraf/"     do not omit the trailing slash!
Put this statement in your .bashrc or .bash_profile file.

How to install IRAF 2.16.1 in Mac OS X, step by step

Obsoleted method. Please follow the "quick and easy" procedure described above


Installing IRAF in a Linux or Mac OS X box has become easier than ever, as basically now one has to download a single tar file, and execute just a few commands to install also the most important external packages.

The IRAF installation procedure should be valid for recent Mac OS X releases running on an 64-bit Intel CPU.

Note for El Capitan (and later releases) users: Due to the introduction of the "System Integrity Protection" policy in the latest version of Mac OS X (see this Ars Technica review for details), there are some issues regarding installing and running IRAF (and xgterm). Please read this IRAF post where some fixes or workarounds are suggested.
Alternatively, install AstroConda (see note above).

Download the IRAF tarfile

Create the /iraf/ tree and unpack the tarfile

  • We follow the standard route and install IRAF into /iraf/iraf/.
    sudo mkdir -p /iraf/iraf/
    cd /iraf/iraf/
    sudo tar -zxvf ~/Downloads/iraf.macx.x86_64.tar.gz


  • Define the iraf variable (the trailing slash is important!):
    export iraf="/iraf/iraf/" (this for a bash shell. For a tcsh shell: setenv iraf "/iraf/iraf/")
  • Run the installation script (we perform a system-wide installation so as to allow different users sharing a same Mac to use IRAF)
    sudo /iraf/iraf/install --system
    The default answers should be fine, but make sure to set "New iraf root directory" to "/iraf/iraf/" if it appears to be set by default to something else (it has been reported that in some cases the suggested value is "/Users/<username>").
  • At this point you should have the "/usr/local/bin/" directory populated with IRAF-related commands, in particular "ecl" and "mkiraf". "/usr/local/bin/" must be included in your PATH (check with echo $PATH); if not, add it to the PATH (for instance, export PATH=${PATH}:/usr/local/bin) You may need to type hash -r to make the shell aware of these new commands.

Install xgterm and DS9

IRAF is best used in a xgterm. You'll also need an image display, the most popular one is DS9.

  • X11IRAF now comes included in the v2.16.1 tarfile, so we only need to create the relevant symlink (no need to download the X11IRAF package)
    cd /usr/local/bin/
    sudo ln -sf /iraf/iraf/vendor/x11iraf/bin.macintel/xgterm
  • Now install DS9, by downloading the appropriate file from http://ds9.si.edu/site/Download.html. Under the link Archive you may find DS9 packages for older Mac OS X releases.

If you are unable to display or interact with images on DS9, getting error messages like "ERROR: Cannot open device (node!imtool,,8192,8192)", you might need to define the IMTDEV variable, as explained in http://iraf.net/forum/viewtopic.php?showtopic=1468688. However, this should not be necessary for DS9 v7.4 and higher versions.

Again, you may need to type hash -r if the bash shell does not recognize the xgterm and ds9 commands (for tcsh type rehash).

Install IRAF external packages

NOTE: The following steps may fail in High Sierra, since the ftp command is no longer available. Please read the IRAF forum post http://iraf.net/forum/viewtopic.php?showtopic=1469719 where the problem is described and a couple of possible solutions are suggested.

From time to time run the make check command to look if updates are available, and install them with make <packagename>. Usually, TABLES/STSDAS is updated shortly after a new release is published by STScI.

Set up IRAF

  • First set up the IRAF home directory and run mkiraf.
    cd ~/
    mkdir iraf ; cd iraf
    mkiraf (select xgterm as terminal type)
    xgterm & or
    xgterm -ls &
    (the latter will launch xgterm as a login shell, use it if you miss the settings or aliases defined in .bash_profile)
  • Check the login.cl file just created. If the cache variable is set to "/tmp" or "/tmp//", change it to something like "/tmp/cache/" or "/iraf/cache/".
  • Then, in the new xgterm terminal window:
    cd ~/iraf/
    ds9 &
    ecl or cl

Fix for PyRAF

  • If you use PyRAF, you may notice that you are unable to run TABLES/STSDAS tasks. The reason is that PyRAF will look for executable files in bin.macintel (the directory for 64-bit binaries), but TABLES/STSDAS binaries are actually in bin.macosx, as STScI only provides the two packages in 32-bit. While IRAF's ecl has a fallback mechanism and will use bin.macosx if bin.macintel is unavailable, PyRAF doesn't.
  • Fortunately the fix is quite simple, as we only need to create a symlink from bin.macosx to bin.macintel
    cd /opt/iraf/iraf/extern/stsdas/
    sudo ln -sf bin.macosx bin.macintel
    cd /opt/iraf/iraf/extern/tables/
    sudo ln -sf bin.macosx bin.macintel
    (the above commands should probably be repeated after each update of TABLES/STSDAS)
edit · print · PDF
Page last modified on March 29, 2021, at 12:03 PM