Installing IRAF on Mac OS X

The first ordeal you’ll have to face with IRAF is getting it installed and running in the first place, and seeing as I’m using a MacBook, this little guide is aimed at OS X installations. A lot of this guide will also be going over the same details as in the old MacSingularity guide, which helped me out no end. Even though the old archive remains online, courtesy of Kelle Cruz at AstroBetter, it seems to be in everyone’s interests not to keep all of our eggs in one basket, so to speak. Besides, as long as I’m chronicling everythingI’ve been through with IRAF, it only makes sense…

Bits and pieces you’ll need

So anyway… Unfortunately, installing IRAF isn’t as trivial as it sounds. Hailing from the days before you could just download a dmg file and drag an icon to your Applications folder, you’ll need to put in a bit more work to get everything working. First off, you’ll want to get a few bits and pieces ready on your computer. You’ll need:

  • X11 – Apple’s x window terminal comes as standard with the newer OS X versions. If you’re running an older OS version, grab the download from Apple here.
  • IRAF – Obviously. Your best bet, if you’re uncertain, is to get the MacSingularity file here. It’s slightly out of date now, but seriously, it works just fine. (Alternatively, if you’re a bit more Linux savvy, you can get the latest version direct from the NOAO site here. They serve up both 32-bit and 64-bit versions, so pick up whichever matches the processor you have. If you’re not sure what your processor is, there’s a helpful Apple support guide here which you can use to find out.)
  • X11IRAF – Yes, it is confusing that you need two packages, but you need this. Don’t worry. It will all become clear. Grab the version from MacSingularity here.
  • DS9 – An exceedingly helpful little utility. Get the latest version here. (And yes, apparently it does actually stand for “Deep Space 9″ – The guy who wrote it was a trekkie).

Ok, so now you have a slightly arcane collection of archived files. Oh, and I hope you’re at least vaguely familiar with using the terminal. If you’re not, you’re going to get a crash course pretty soon. Don’t worry, it’s not that difficult really.

Handing IRAF the keys

For reasons which I don’t fully understand, and don’t really care enough to find out, IRAF needs its own user account to install properly. Go into System Preferences and then go to the Accounts control panel. Set up a user called IRAF and make it an Administrator account (while trying to quell the feelings that you’re handing your computer over to a mysterious stranger). All done? Good. Give it a silly user picture if you like. Because, you know, why not? Okay, so now you’ll want to put the IRAF install files into the shared folder so that you can log in as IRAF and get hold of them. So just log out from the Apple menu now, ok? Then you can log in as IRAF, open up a browser window and come back here to figure out what you’re doing next… When you’re logged in as IRAF it’ll feel momentarily like you’re wearing someone else’s clothes, seeing as all of your customisations and things won’t be applied here. Don’t worry about it, and don’t waste time changing your user settings. You’ll hopefully never need to log in as IRAF ever again. Fish the archived files out onto your desktop and double click them to decompress them. If you got the right packages, you should find that after you decompress them, they’ll show up as pkg files. These are just your standard OS X packages, which you can double click and install normally. Depending on your system version (again for reasons which are beyond me) you may get an error message after installing telling you that you should try again. Don’t try again, it’s ok. Error or otherwise, it should still work. You might be coming to realise by now that installing IRAF is something of a dark art.

Terminal Sickness

If you’ve never used the Terminal before, you’ll find it in the Utilities folder lurking in your Applications folder. The terminal will become your best friend. Or possibly your arch nemesis, depending on how much you like text command line interfaces. Unfortunately, if you don’t like them, installing IRAF is probably not going to be your best move. Don’t say I didn’t warn you. So once you have your terminal window opened up, you’ll want to type;

cd /iraf/iraf/unix/hlib/

This takes you to the centre of the hornets nest where you’ll find all of the install files. Now, you get to use the fabled sudo command. So type;

sudo ./install

This is Linux language for “run the install script and damn the consequences.” Needless to say that a command like sudo shouldn’t be used lightly, so chances are the terminal will give you a short lecture at this point on the perils of sudo. Acknowledge this and move on. Sudo will then ask for a password – specifically the IRAF user’s password. So type it in and let the install script do its thing. You’ll need to answer a couple of questions, but as I recall they’re all fairly straightforward. One thing though. When it asks you about the IRAF local commands directory, tell it to use /usr/bin– this should be the default anyway. Fingers crossed you shouldn’t get any errors. Ok, so… did it work? All done? Brilliant. Go and make yourself a cup of tea, and celebrate having IRAF installed on your system. You can now log out and log back in as yourself, and never ever have to log in as IRAF ever again.

How to make IRAF cool

Ahhh, it must feel nice to be logged in as you again. This section is entirely optional. It’s a series of hacks to make things feel nicer to use. You don’t need to do any of this to get IRAF to run, so if you don’t care about aesthetics, feel free to skip this whole section and go directly to the section below on running IRAF. If, however, you’re like me and you prefer things to be look nice and feel comfortable, then read on…

Hiding the IRAF user

Well first off, you might want to hide that ugly old IRAF user. Out of sight, out of mind, right? If you’re running OS X version 10.4 or later, there’s a nice easy way to do this. Open a terminal and just type;

sudo defaults write /Library/Preferences/ HiddenUsersList -array-add IRAF

It’s another sudo command, so you’ll need to type your own password this time. This is the quickest way to hide the user IRAF from the login window. Of course, if you think you’re up to the task, you can completely hide everything about the IRAF user, including its home directory, using a few more advanced steps. Hey, if you’re doing this kind of thing, you might as well learn all the tricks, right?

Installing TotalTerminal

TotalTerminal, formerly known as Visor, isn’t essential. But it is very cool. Easy to install, just download the install files and instructions from here. This will give you hotkey that drops a terminal down from the top of your screen, whatever you might be doing. Hit the same command again and it’ll vanish back from whence it came. Ok, so I think it’s cool anyway, and it definitely gives you some bonus geek cred. If this isn’t your thing though, just add the Terminal icon to your dock. It’s the same thing, only… not as cool. Obviously.

Fun with X11

So to run IRAF you’ll need to run it from the X11 terminal. Unfortunately, the X11 terminal is an ugly looking thing, which lacks the style and finesse of the regular white-on-black Terminal app. Actually, there’s more than just style involved here. If you’re going to be looking at a screen for a long time, white text on a black background is much more comfortable for the eyes (and it can actually help prevent eyestrain). Why do you think most terminal apps are white-on-black by default? So here’s how to make IRAF’s terminal look nicer, and run it directly from the regular terminal (so you can use it with the TotalTerminal widget you just installed). This is a little hack that’ll let you run IRAF from a regular terminal, just like you would from a Linux machine. Open up a fresh terminal, and while you’re in your home directory, type;


Vim is a text editor program, and you’re going to use it to create a little shell script to run a set of commands that will make things prettier for you (a little guide to vim can be found here, if you want it). In this file, hit first to enter “insert mode” and type the following;


cd /Users/$USER/iraf
xgterm -bg black -fg white -fn 9x15

When you’re done, hit esc to leave insert mode and type :x to save and close this down (a quick little vim shortcut which most people don’t know about – for anyone who’s used vim before, it does the same as :wq). Now type;

chmod u+x

To make your script executable. Next you’ll want to set up the command you want, so type;

vim .bash_profile

In OS X, the .bash_profile file is a hidden file which stores various user-specific things (for Linux users, it’s the same as your .bashrc file). You’re going to add a few lines into this. Don’t worry, it’s perfectly safe. Just don’t edit anything that’s already there, ok? Scroll to the bottom of the file and hit iagain to insert text. Type the following lines into the file;

# X11 Commands
export DISPLAY=:0.0
alias x11='open -a'

alias xgterm='x11 /Users/$USER/'

Ok, now once again, hit esc to leave insert mode and type :x to save and close the .bash_profile file. None of these changes will take effect immediately, so quickly reboot your computer now. One of my favourite things about OS X is how quickly it always boots up.

Running IRAF!

Nearly there! If everything worked before, you should now be able to run IRAF properly. So open up a terminal window (an X11 terminal window if you skipped the optional section on coolness) and follow these final instructions… Firstly, from your home directory type;

mkdir iraf

This makes a folder where you can let IRAF leave all of its clutter, which would otherwise litter your home directory. Now type;

cd iraf

It’ll ask you for a terminal type. Select xgterm. The mkiraf command will create a couple of things – a file called and a directory called uparm. You can ignore uparm, it’s just where IRAF keeps its parameter files., on the other hand, may need a little adjustment. So type;


You should be becoming familiar with vim by now. Use the arrow keys to scroll down and you should see a line which reads;

#set imtype = "imh"

Chances are good that you’ll be working with fits files, so hit for insert and edit this line to read;

set imtype = "fits"

Remember to remove the # from the start of the line, otherwise IRAF will ignore it. Then one last time, esc and :x to save and quit. Now whenever you want to run IRAF, just go to your terminal (X11 terminal if you didn’t follow the section on being cool) and type xgterm. Then in the window that pops up, just type cl. Congratulations, you’ve installed and loaded IRAF!


You’re all done! Everything’s all set for you to do whatever it is you want to do! Congratulate yourself and go and enjoy a beer. Or some ice cream. Or whatever you like to consume when you’re relaxing. I know my method here is a bit long winded, but once it all works, it’s smooth sailing. I hope everything here works for everyone reading this. If you have trouble, I’m not sure how much help I can be. I’m definitely no expert. But if you spot anything wrong with my little guide here, or find a better way to do something, please please please drop a message on this page and let me know? IRAF is a headache, but if we all help each other out, perhaps it doesn’t have to be!

About these ads

One Response to Installing IRAF on Mac OS X

  1. Hello, I am a graduate student in physics at the University of North Texas. My research area is astronomy with a focus on spectroscopic analysis of active galactic nuclei. The first task of my research project is to install and learn IRAF (on my personal MacBook Pro). I read through your installation instructions, which were fantastic. So first, I want to thank you for this website, especially this page. I downloaded and installed all of the critical components, then I came across a few errors once I arrived at the Terminal and began the “Query for System Settings”. What are the chances that I could borrow your knowledge and expertise to assist in completing the IRAF installation process?

    Many thanks in advance,
    Charli Rust
    Graduate Student in Physics with prior degrees in Engineering

Sorry, but I've disabled name/URL comments. I've had a lot of trouble with spam lately...

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s