OS X for Astronomers:   Setting up your Apple computer for professional astronomy
by Jane Rigby (Carnegie Observatories)
If you're a scientist who bought
an Apple computer as a scientific workhorse,
read on. I assume you want to
write scripts, reduce data, view FITS images, plot
results, work with latex, pdf, and postscript, and give presentations.
I also assume that you're using the "OS X" operating system
(true for post-2001 Apples), and that you are comfortable using unix/linux.
I wrote these instructions for G4 apples running OS X 10.3, and overhauled them to
work on OS X 10.4, 10.5, and Intel processers.
(There are several apples-for-scientists sites, so if my page doesn't answer your questions,
try these links.)
A brief preface:
Your Mac's operating system is called "OS X". It is a version of BSD Unix with a fancy graphical interface.
Because Unix is the engine under the hood, you can use all your favorite linux tools, plus prettier
programs written for Apples. These instructions show you how.
Apple's graphical interface has you click & drag, graphically, in Finder menus
("Drag folder Crapdir to the trashcan.") At first you may resent the GUI interface.
If so, remember that you can do everything from a terminal shell instead ("rm -rf Crapdir/").
You'll need to experiment to determine when it's easier to use a terminal or a menu.
I've re-organized these instructions into the following categories:
X11 is the standard linux graphical window environment. You must install X11 before you can use
any of the standard graphical programs written for li/unix, including most astronomical software.
Before you do anything, which version of OS X do you have?
Click the little apple in the upper lefthand corner of your screen, and choose "About This Mac".
If you have OS X 10.5 ("Leopard") or 10.6 ("Snow Leopard"), then X11 is already pre-installed. Yay!
Skip ahead to "Once X11 is installed".
If you have version 10.4 ("Tiger") or earlier, you can get X11 in one of two ways:
METHOD 1: Install X11 from the DVD or CDs that came with your computer.
To do this, insert the install disk and user Finder to search for
"X11User.pkg". (Finder is the blue happy face in the Dock.)
Double-click on X11User.pkg, and X11 should install.
METHOD 2: Download X11 v1.0 and
the update package 1.1.3 from Apple.com.
This appears to work only for PowerPC. (Let me know if these links goes bad -- Apple keeps moving them.)
Once X11 is installed, drag the X11 icon or the Terminal icon from /Applications/Utilities to your Dock.
Now, anytime you want a terminal session, just click that icon in the Dock. A terminal will open, and you'll get a
real linux-style terminal. Type "df", "ls", "emacs",
and prove to yourself that you've got unix under the hood!
Try these great tricks:
Type "open -a preview foo.pdf" in a terminal. The computer
will open the file foo.pdf in the Apple PDF viewer named "Preview". Even better, type
"open foo.pdf". OS X will open foo.pdf using its best-guess application,
just as if you'd double-clicked it.
These two tricks let you use OS X-native programs
from the X11 command line. Read more here.
Second step: get yourself a C compiler (and optionally, a fortran compiler).
Gcc is the standard gnu C compiler. You need it to build programs
from source, and to compile your own C programs.
OS X was built using gcc, so they play well together.
Unfortunately, gcc isn't installed by default; you must install it.
Here's how to install Apple's binary version of gcc:
Insert the DVD/CD that came with your computer into the drive.
Use Finder to search the disk for "XcodeTools.mpkg". Double-click to
install. This gives you gcc, Java, and many other developer tools. To learn more,
read "About Xcode Tools.pdf", which may be on your computer,
and is definitely on your install disc.
Some users prefer sourceforge's version of gcc. (One advantage for some:
the modern fortran compiler g95 comes with sourceforge's version but not Apple's.)
High Performance Computing provides gcc binaries compiled from CVS source code
(powerPC or Intel).
If you code in Fortran and/or use pgplot, you also need the g77 fortran compiler, which is available in several ways:
PowerPC macs: Either download the appropriate g77 binary from HPC, or
install Fink (next step) and have Fink install g77.
Where the hell's the root account?
'Nix users are used to logging in as the all-powerful root
user ("/bin/su"). By default, OS X has no root user!
Insteads there's an "administrator" account: a regular
user who, upon request, can issue commands with root permission by
prefacing the command with "sudo". (sudo = do as root).
So to run "make install" with root permission, you would type
"sudo make install". [Or you can create a root acct.]
Incidentally, this is why fink frequently asks for your password -- it's
doing "sudo make install."
If you're not sure who the administrator is, go to System Preferences,
Accounts.
Since the heart of Mac OS X is BSD Unix, most of your familiar
unix/linux commands are available from an X11 terminal:
perl, which, top, emacs, gzip, pine. But you may want to install other
linux programs (gv, xemacs, tetex, etc.)
The management tool "Fink" helps you do this -- it explains what packages are available,
installs them for you, updates them, and un-installs them.
Most people also use Fink Commander, which is a graphical
interface to Fink. Search the web for Fink and Fink Commander, and
you'll find several good websites that explain how to install them.
Four tips for running Fink and Fink Commander:
Fink puts packages into /sw, and binaries in /sw/bin/.
Therefore, you should add /sw/bin to your path by altering your config file
(.cshrc, .bashrc, etc.).
When fink commander lets you choose between
binary or source install, choose binary -- it's much faster.
Some packages you may especially want: "xemacs" (just the program); "gv"
"xemacs-sumo-pkg" (all the add-ons); tetex (includes latex);
"g77" (currently fink only has g77 for powerPC;
MacIntel users can get g77 here); "xmms".
More fink packages exist for PowerPC than for Intel.
Tex & Latex ("Hbox badness 10000!")
You'll need a Tex distribution, which provides the executables "tex", "latex", "dvi", etc.
There are various ways to do this.
Kelle at AstroBetter has written
step-by-step instructionsfor setting up latex by installing several packages including the
MacTeX package. This package gives you tetex,
the graphical Tex front-end TeXShop,
ghostscript, and "convert". Go follow Kelle's instructions and you should be texing in no time.
Because I am old-fashioned, I run
latex on the command line in one step, using this .cshrc alias:
alias texerpdf 'latex "\!*".tex; latex "\!*".tex ; dvips -t letter -o "\!*".ps -P pdf "\!*".dvi; ps2pdf13 "\!*".ps "\!*".pdf'
Gnuplot: works well, with either "set term X11" or "set term aquaterm".
If you've installed scisoft, you should have gnuplot;
alternatively, you can install gnuplot using fink.
The Perl module for pgplot, called pgplot.pm:
(This module lets you call Pgplot subroutines from Perl -- it's how I make plots.)
I've gotten this working on both PowerPC and MacIntel machines.
Update! The inventor of pgperl has an
experimental new package called SciKarl,
which installs pgplot and the PDL & pgplot perl modules all at once.
It's supposed to be an easier way to install the pgplot perl module.
Please try it and let me (& Karl Glazebrook) know how it works!
Alternatively, here's the other method of installing pgperl, which is a pain, but I know it works:
Downloaded the MacIntel version of Scisoft.
This installs the fortran pgplot program.
Tried installing pgplot.pl, with the command "sudo perl -MCPAN -e 'install PGPLOT'". The installation died complaining
of missing dynamic libraries (*.dylib).
Used "locate" to find each missing library, and place a symbolic link to each in /usr/local/lib .
For example: "sudo ln -s /scisoft/i386/Packages/pgplot-5.2.2/libpgplot.dylib /usr/local/lib".
I had three missing libraries: libgfortran.1.dylib, libgfortran.1.dylib, and libaquaterm.1.0.0.dylib.
My trickiest was aquaterm: linking it required this command:
"sudo ln -s /scisoft/i386/lib/libaquaterm.1.0.0.dylib /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm".
Re-ran step 3 above after adding each symbolic link, until pgplot.pm installed correctly.
Requested "/AQT" as the pgplot device, when queried during post-install testing. Pretty pgplots
appeared, and I was happy.
ESO has packaged many astronomical tools into one easy-to-install lump call Scisoft.
Scisoft includes iraf (!), pyraf, gnuplot, pgplot, csfitsio, wcstools, xephem, etc.
By far, this is the easiest way to get Iraf & Pyraf. You need this package.
Here's how to download it. Go to
Scisoft.
The "Download" tab shows the last stable releases for PowerPC and Intel computers and OS X 10.5.
The latest scisoft does NOT work on 10.4; you'll need to select the "News" tab and download
the old version from Feb 2008.
Installation is easy; just follow the instructions. Executables will be stored to /scisoft/*/bin/ .
The scisoft Readme tells you to add that directory to your path through your .cshrc or .bashrc file, and
add a line like: alias scisoft "source /scisoft/all/bin/Setup.csh".
One tip that's missing: when you initialize iraf's preferences with "mkiraf", and it asks what
terminal -- PICK "xgterm"!
To start iraf, just type "xgterm &" in an X11 terminal,
then type "ds9&; cl" in the new xgterm window. That's it.
Scisoft installs many handy packages at once, easily,
but often they're not the latest versions.
When you need the newer versions, try using fink commander, or check a particular program's website for an OS X version.
Again, Fink executables are installed in /sw/bin, and
scisoft packages are installed in /scisoft. Got it?
Apple's "Safari" browser is the default, but you may prefer Mozilla's open-source
Firefox for OS X.
If you want to screen out annoying ads and flash animations, open Firefox, and
under the menu "Tools>Extensions", install "Adblock" and "Flashblock".
Spreadsheets, Databases, and Word Processing
For a free OS X implementation of Open Office, try
NeoOffice.
Alternatively, buy "iWork" at your local Apple store (remember the educational discount!),
which includes Keynote (presentation), Numbers (spreadsheets), and Pages (word processing.)
Or you could pay Microsoft for Office. But I can't condone that sort of thing.
Desktop Pagers
How can you work without multiple desktops, especially if you have a small screen?
You need an organizing "pager". This is built into 10.5, in a program named "Spaces".
If you have an earlier version of OSX, or like me you hate Spaces, you can add a pager.
I like You Control: Desktops,
which costs $30, and works great for 10.5 and earlier, but is not compatable with 10.6.
For old apples with PowerPC (non-Intel) chips,
try the free tool called Desktop Manager,
also available (here.)
A more fully-featured alternative, for $40,
is Code Tek's Virtual Desktop Pro.
Unfortunately, neither program works properly with Mac Intel machines yet,
(though an older version of Desktop Manager, v0.5.0 works decently.)
Once you've selected a Pager and saved it to /Applications, you may want it to
auto-start when you log in. To do this, got to System Preferences, Accounts,
Login Items, and add drag the Pager icon from /Applications onto your login list.
If you're paranoid, quit the pager before connecting to an LCD projector
to deliver a presentation (select Quit from the pager menu.)
Fetchers for the Astronomy Picture of the Day
Several tools will download the APOD for you, and set it as your backdrop.
Try Auto APOD (power-pc only),
APOD Grabber,
or write a simple script to fetch and resize it.
A fast way to crop, invert, and browse images.
Binary here.
How to install IDL
Download IDL 7 from www.ittvis.com.
Add the following two lines to your .bashrc (or the equivalent if you use a different shell):
source /Applications/itt/idl/bin/idl_setup.bash
export IDL_PATH="+/User/me/idl/:<IDL_DEFAULT>"
(This assumes that /Applications/itt/ is the likely default installation path, and that
"User/me/idl" is your private scripts directory. The + is required (for a recursion),
and IDL_DEFAULT ensures idl can find the standard idl libraries.)
Then run the License Wizard. If it fails with a write permission error,
cd to /Applications/itt/idl70/bin and run 'sudo lmgrd'.
IDL may have trouble under leopard recognizing mouse events in plot windows. If so,
try setting 'Click-through Inactive Windows' under X11 preferences.
Backup your data!
There are many ways to back up your precious data. If you have 10.5, you can use
the built-in apple program Time Machine for incremental backups.
If you don't have 10.5, or don't trust Time Machine, you have several options.
I'm a fan of Carbon Copy Cloner,
a freeware program that schedules incremental rsync backups. CCC can also backup
automatically whenever a specified external drive is plugged in.
You'll want to log into remote computers and display windows on your
apple. To do this, in an X11 term, start a secure ssh
shell like this: "ssh -Y hmilk@camera.castro.edu".
(The "-Y" flag
means "allow and trust X11 forwarding", so it will remotely
display windows and graphics.
Some linux flavors have -Y or -X by default, but in OS X you need to specify -Y.)
Set applications to auto-start when you log in
Certain applications (e.g. Desktop Manager, X11) are so handy that you
may want OS X to start them automatically when you log in.
To set this up, go to System Preferences, Accounts, Login Items, and
add applications.
Multi-button mouse functionality
OS X is easier to use if you have a 3-button mouse (right- and center-clicking brings up options
menus, just like you'd expect.) Also, most X11 programs assume 3 buttons. For desktops,
just add a 3-button USB or Bluetooth mouse, or use the now-standard Mighty Mouse, then do the following:
select "Emulate 3 buttom mouse" from the X11 Preferences menu;
go to System Preferences>Keyboard \& Mouse and fuss with the button choices.
Laptop users -- sorry, but Apple laptops only have single-button trackpads (Why, Apple, why?)
Work-arounds to get 3-button functionality:
Buy a 3-button USB or Bluetooth mouse, and carry it with you. OR:
When you click, hold down the Control or Alt keys to emulate
center and right button clicks. OR:
Upgrade to the
Sidetrack trackpad driver. Sidetrack maps
regions of your trackpad into scroll-bars and multiple buttons.
It's customizable, works okay, and costs only $15.
Improve your Dock
Unlink dippy applications:
Everything in the Dock is a link, not an actual program.
So feel free to
remove seldom-used programs from the Dock by dragging them off the Dock.
You can always find those programs later with Finder.
Link useful applications:
Add to the Dock new programs like X11, Firefox, Fink Commander, and OpenOffice.
To do this, drag their icons from the Finder to the Dock.
Also, you may want to add "Applications/Utilities/Activity Monitor"
to your dock; it's a graphical version of the unix command "top".
X11 and account setup tips
You may want to change your shell from the default, for example to /bin/tcsh. Use "chsh".
In X11, follow the X11>Preferences menu, and change the options to suit.
Create xterms with scrollbars: Under X11>Applications>Customize: change Terminal "xterm" to "xterm -sb -sl 1000".
Connect your laptop to an LCD projector
Follow this sequence in order:
Those little white cord adapters that came with your apple laptop? Bring them!
On your laptop, go to "System Preferences > Displays".
Connect the little adapter to the projector cord.
THEN, plug the adapter into your computer. (The order of operations matters.)
If the projector doesn't automatically show the image, hit the
"Detect Displays" button in the "Displays" menu. When new windows pop up,
be SURE to check the box that says "Mirror Displays"!
This makes sure projector and laptop show the same information.
If the Dock disappears, just click on the Apple
symbol at the upper-left, and get to System Prefs > Displays from there.
Experienced presenters often turn "mirror displays" off,
and use "Presenter Notes" in Keynote or Powerpoint. In this mode, your laptop screen
can display a timer, clock, and notes, while the projecter shows only the slide.
This is a great way to avoid reading slides to your audience, but ensure you'll remember
what you wanted to say.
Get protective sleeve for your laptop.
I like Shinza.com's "Zeroshock" protective sleeves.
They use a high-grade foam that compresses slowly, reducing the acceleration
imparted to your computer when you bang it around.
This page was written by Dr. Jane Rigby,
an astronomer at the Carnegie Observatories.
Please email Jane at
if you: a) found this page useful, b) found an error in this page, or c) have a tip to add.
If you have technical problems, please don't email Jane -- ask the interwebs, your friends, your sysadmin, Apple's tech support,
or pray to
Lord Zorkon.
Copyright Jane Rigby.
Page created 14 January 2005. Last updated July 2010.
"Apple", "OS X", and "Powerbook" are trademarks of Apple Computers.
This page is not endorsed by Apple, OCIW, or Lord Zorkon.
Astronomers Emeric Le Floc'h, Casey Papovich, Richard Cool,
Eric Mamajek, Wayne Schlingman, Karen Knierman, Martin Elvis,
and Phil Massey have certified that this page is not entirely useless.
Astronomers Richard Cool, Colin Snodgrass, Phil Massey, Christopher Willmer, Ivo Labbe,
Adam Ginsburg, Sara Ellison, and George Becker
have suggested useful tips & corrections. Please send yours!