Mac OS X for Astrophysicists
Since more and more astrophysicists are starting to use Macs as
laptops for their work here is a beginner's guide to software you may
want to look at and a few links to useful sites.
I've now got an Intel Mac, so I'll start marking out things that I
know definitely work on it. i denotes something that I know
works under Rosetta emulation, and i denotes something that I know
has a native or universal binary. If there's no i it
means I don't know (I'm yet to find anything that flat out doesn't
work).
Recent changes: Reorganised X11 section, a few Leopard updates and misc other minor changes 16/11/07, link update 19/11/07, link update 3/12/07
Contents
- Astronomy software
How to get standard astronomy software like IRAF.
- About Xgrid
Information on the new OS X distributed computing tool.
- X11
Tips for using X11 on OS X.
- Standard tools
C compilers, X Windows, other tools you'd find with most Linux distributions.
- Presentations
Tools for talks
- Document preparation
LaTeX and the like
- Other applications
Other applications you might find useful
- Command line tips
Tips for interfacing the command line and the standard Mac OS X
environment.
- Useful links
Astronomy software
- IRAF
IRAF is available as a special Mac package from the maciraf
page. These need to be installed as an 'iraf' user. This user would
normally appear as one of the login options and with a home directory
unless you use couple of little tricks.
Mac OS X doesn't show users for login unless their UID number is
over 500. You can make the iraf user invisible in this way by doing
the following:
1) Download all the packages and put them somewhere the iraf user
(which we will create later) can get at them. Your 'Public' directory
should be ideal for this.
2) Create the iraf user (see the maciraf installation page, or just
use the System Preferences utility - it is very simple) and whilst in
System Preferences make your 'Login Options' (under 'Accounts') the
'Name and password' option. Also make sure the new user is an
administrator.
3) Open the Terminal and type 'nireport / /users uid'. This
gives you a list of current UID numbers. Pick one below 500 that is
not in the list. I chose 50.
4) From 'Netinfo Manager' in your Applications/Utilities folder go to
'users' and pick the 'iraf' user. Search for the 'uid' property and
change it to your chosen number. Also, check that the 'gid' is set to
20 for the staff group (this was an issue with the maciraf package and
Panther that may have been resolved now, but this should be fine to do
anyway). Close Netinfo Manager.
5) Switch to the login window and log in as iraf.
6) Open the Terminal and fix your home directory permissions with:
cd ..
sudo chown -R iraf iraf
sudo chgrp -R staff iraf
and if sudo asks for a password use iraf's password.
7) Continue with the installation of iraf as normal.
8) If you want go back to System Preferences and change your 'Login
Options' back to 'List of users'.
9) Go back to Netinfo Manager and set the iraf user's shell to
/usr/bin/false. This step is necessary to hide the user in Tiger.
10) One last step to hide the iraf user's home directory in the Finder
- make sure DevTools are installed (see below) and in the Terminal perform:
sudo /Developer/Tools/SetFile -a V /Users/iraf
- ESO-MIDAS
ESO-MIDAS has a
native Mac OS X binary now but it can also be compiled from
source. You'll want to install Motif libraries from Fink or similar
beforehand (again, see below).
- ESO Scisoft
Scisoft is available for OS X from here and is regularly
updated.
- IDL i
Not strictly astronomy software, but I'll include it here. IDL comes in a Mac OS X version. If
you can't get a license for it then you might get away with GDL as an
alternative. It implements a fair bit of IDL, but not all of it. A lot
of the astrolib work (including READFITS and WRITEFITS). GDL is
available via Fink (see below, unstable branch only, and problems have
been reported compiling it from Fink) or download GDL from here.
- JObserve
Download JObserve from here.
There's now an 'unsupported' Mac download available, or you can
install it by following the 'everything else' instructions. If you
choose that route you will need to edit the resulting jobserve.sh
script as follows:
OSTYPE=`/bin/uname` to OSTYPE=`/usr/bin/uname`
Add the following before "*"):
"Darwin")
JAVA=/usr/bin/java
$JAVA -Djava.security.manager -Djava.security.policy=$JO_HOME/java.policy \
-cp $JOPATH edu.nrao.vla.jobserve.Observe -d $JO_HOME $*
;;
- Starlink i
A binary installation of Starlink and the source can be downloaded
from here.
There are now Intel binaries, and if you have any difficulties
compiling it from the source I'm told by Brad Cavanagh (the release
manager for Starlink on OS X) that if you have any difficulties with
it you should be able to get it compiled by downloading g95, setting
F77 and FC to 'g95' and proceeding with the instructions in the README
file.
- AIPS
AIPS installs on Macs and there's a page of instructions here.
- GIPSY
Thanks to Erwin de Blok GIPSY has been ported to the Mac. It's
available from here although
the patches should make it into the main tree soon.
- MIIPS
Donald Gudehus's MIIPS package runs on OS X. Download from here.
- HEAsoft
HEAsoft (FTOOLS and XANADU) is available here for OS X.
- Stellarium i
Stellarium is a virtual
planetarium that works on OS X. Not tried it myself yet but it looks
like it could be a handy bit of software, especially if you're after
some fancy graphics for outreach work or similar things.
- The UltimateAstroWidget i
The UAWis a handy Dashboard widget for
astronomers. It gives a handy clock for where you're observing
from, giving LST etc., as well as airmass plots, and
a tool for figuring out the observability of an object at
a given time and place.
- QLFits i
The same site also hosts QLFits,
which lets you very handily inspect FITS headers from inside the Finder.
Xgrid
Xgrid is a
new tool in Mac OS X 10.4 (Tiger) which makes it easy to distribute
heavy number crunching across a group of Macs (there is a preview
version for 10.2.8 or later). It automatically detects available nodes
and sends jobs to them, and does it all in the usual point-and-click
interface (although you can work from the command line if you
wish). Just give it your command line program and tell it how to vary
the calling argument (e.g. 'myprocess -begin i -end j') and it'll send
the job out and collect all the results for you. See also this
page.
X11
Many of the tips here are for Tiger only, or are untested in Leopard. Look out for warnings, but if there's no indication as to which version these apply to then they're untested.
- X11.app in Tiger i
Also on one of your DVDs should be the X11 package, which gives you an
X server (look for the Optional Packages installer - scroll down the
DVD contents). If not, get it from
Apple if you are a Panther (10.3) user. It can mix your X11
windows in with your standard OS X ones, or it can run fullscreen. If
you choose this option from X11.app's preferences then switch between
your desktops with Command-Option A. The Command key is variously also
called 'apple', 'clover', or 'pretzel'. This should be a good clue as
to which one this is. The Option key is the one marked with a slanted
symbol, normally left of the leftmost Command key and shared with
'alt'. If you choose the fullscreen option you'll want a suitable
window manager, probably from Fink or DarwinPorts (below). Once you've
got one installed do:
cp /private/etc/X11/xinit/xinitrc ~/.xinitrc
and edit the .xinitrc file with emacs, vi, or your chosen editor and
replace 'exec quartz-wm' on the last line with 'exec wmaker', 'exec
fvwm2' or whatever you have chosen.
Intel users - whilst X11 works almost entirely without problems there
is one little bug that will drive you totally up the wall if you try
running a remote emacs on certain other systems. There's a fix here
thank goodness!
Note - don't try that fix on Leopard!
- X11 in Leopard
X11 got a fairly sizeable overhaul for Leopard. I've not yet installed Leopard, but here's a couple of useful links that might help out with the bugs that are in it:
- SSH
If you have problems such as being unable to paste or windows
disappearing try invoking ssh as 'ssh -Y' rather than 'ssh -X'. This
uses a newer ssh feature called 'trusted X11 forwarding'.
- Copying and pasting
The Mac OS X pasteboard is completely separate from the X11
clipboard. Within X11.app the highlight-to-copy and
middle-click-to-paste behaviour works as you'd expect. In the native
environment the Edit menu or Command-C/Command-V lets you copy and
paste to the OS X pasteboard. To work between the two:
Paste from X11 to OS X - select your text in your X11 program
to copy it to the X11 clipboard, then in the 'Edit' menu at the top of
the screen select 'Copy' or use Command-C. Paste to your OS X
application as normal.
Paste from OS X to X11 - a bit confusing as the 'Paste' menu
option in X11.app is greyed out most of the time, but if you copy text
it should automatically go to the X11 clipboard. From there, just
middle-click or Control-V as normal. Alternatively, don't forget
'pbpaste' mentioned above.
- Changing the startup
Do 'cp /etc/xinit/xinitrc ~/.xinitrc' to give yourself a
personal startup script you can edit (see below)
- Keeping quartz-wm features
quartz-wm is the window manager that gives X11 the Mac OS X
look and feel. You may decide to change this for another window
manager by editing a .xinitrc file but if you do this it is
worth running 'quartz-wm --only-proxy' before your
alternative window manager as this will let you use copy and paste as
normal.
- Focus follows mouse
If you use quartz-wm then try at the command line the
following:
'defaults write com.apple.x11 wm_ffm -bool true' to get
focus-follows-mouse in your X windows.
'defaults write com.apple.x11 wm_click_through -bool true' to
disable the way that a click will activate a window but not pass the
click itself through to the application underneath.
Want it in Mac OS X itself? Have a look at Codetek Virtual Desktop linked above. Also, the
Terminal program has an option for this, enabled with 'defaults
write com.apple.Terminal FocusFollowsMouse -string YES' and
disabled with 'defaults delete com.apple.Terminal
FocusFollowsMouse'. It might be a bad idea to extend it to OS X
applications generally since you'll inevitably want to use the menubar
at the top at some point, and you could easily end up switching
application en route!
- Nicer fonts in xterms
Try starting an xterm with the following options:
'xterm -fa Monaco -fs 11'
This starts it using a Monaco Freetype font with size 11.
- Proper detection of the DISPLAY variable in Tiger
Note - Leopard does things very differently. Don't use this on that system.
A standard OS X application won't know what your DISPLAY variable has
been set to in X11. This means you can't start an X11 application from
Terminal.app unless you use open-x11 described earlier. This
script should pick up your DISPLAY setting and set it correctly, so
you can source this in Terminal.app and then use X11 applications as if
you were in an xterm.
if [ -e /tmp/.X11-unix/* ]
then
X11_FOLDER=/tmp/.X11-unix
currentUser=`(set \`whoami\`; echo $1)`
bb=`ls -l $X11_FOLDER | grep $currentUser`
bbb=${bb/*X/:}
usedDISPLAY=$bbb.0
export DISPLAY=$usedDISPLAY
fi
Thanks to Dietrich Onnasch who originally posted this in
comp.lang.idl-pvwave, and Nathan Nutter who provided a modification to
help avoid errors when not running X11
Standard tools
- Developer tools i
Make sure you install the Developer Tools! If you didn't get an XCode
CD/DVD then get it from Apple's
Developer site after free registration. It's a big download, but
essential as it has gcc and many other vital tools. Also, it
has the X11 SDK you'll need to compile X11 software.
- Fink
Fink is a commonly used
package manager for *nix software on OS X and is pretty well supported
in the general Mac community. It is well documented and easy to use,
and one of the best ways to get other window managers, LaTeX and most
other standard X11 applications and the like.
- DarwinPorts i
DarwinPorts is
another package manager for *nix software. It got off
to a slower start than Fink, but many users are changing over due to
various frustrations with Fink. I recently switched over, and have yet
to find any complaint (other than emacs doesn't build with X support
by default, see below). (Intel note - most packages reportedly work
fine but it's not guaranteed all will)
- Emacs i
The default emacs on OS X is not compiled for X11. Either roll your
own, grab one from Fink, DarwinPorts (do sudo port install
emacs-devel +x11), or get a 'Carbonised' emacs for a native OS X
feel (DarwinPorts users do sudo port install emacs-devel
+carbon). If you install xemacs from Fink make sure to also
install the xemacs-sumo-pkg package to get all the extras.
If you
want a native version you might also try Aquamacs (a universal binary too), or
there are older versions such as the carbon-based emacs package
(v21.4) available from the yaced
SourceForge site (Tiger users only), and Apple has a link to one
here,
and lastly a Cocoa-based Emacs.app is available from this SourceForge
page. The Cocoa port probably integrates a little better with OS X
than the Carbon ones, but the Carbon port may have other features you
prefer.
Presentations
For presentation software you have three or four options. You can use
OpenOffice.org or NeoOffice (a branch of OpenOffice
for OS X), or your usual TeX based solution you might use on a Linux
machine. Alternatively the two big presentation packages on OS X are:
- Microsoft Office
Office
is very commonly used and Powerpoint
is available for the Mac. This is probably the most common
presentation package, but I've never used it myself.
- Keynote i
Apple's own solution, Keynote (now part of iWork along with Apple's Pages
word processor and the Numbers spreadsheet) is relatively cheap,
simple but very powerful and capable of 3d fancy graphical changes
that are guaranteed to ruin a talk just as well as any overly sugary
Powerpoint twirl-and-fade. Also available with an educational
discount, this is a real bargain and has excellent dual-head support
for Powerbook owners. If you don't already have Office and aren't
planning on getting it this is well worth the money. Vector graphics,
like PDFs (which are now easily created from your PostScript files)
drop in easily making it a doddle to drop in LaTeX typeset equations
without any pixellation. It imports Powerpoint files reasonably well,
and also exports nicely to PDF and Quicktime movie files.
- Salling Clicker
Essential for gadget freaks with Bluetooth-equipped Macs, the Salling
Clicker lets you use a Bluetooth PDA or phone to control other
applications, most usefully perhaps Powerpoint or Keynote. This means
your mobile phone can be the remote control for your presentation. The
fact that it lets you run iTunes and other applications from a
distance is a bonus! It costs money, but not very much at all. (Note
that apparently since Tiger some people do this without the extra
software - I haven't needed to use Salling Clicker since upgrading,
but it's still first-rate software)
Don't use AppleWorks for presentations. It really is too out of date
for that (although it is still useful for simple word processing,
vector and bitmap art, poster design and other tasks).
Document preparation
- LaTeX i
LaTeX is available from Fink or DarwinPorts above, amongst other places (but if you've
installed one of those anyway it's easiest to get it from there). Also
note that Panther (10.3) and later can convert Postscript to PDF with
a built-in distiller, and look out for applications like TexShop
and iTexMac which are specially
designed for preparing TeX-based documents. Alternatively your trusty
emacs is readily available.
For typesetting equations for
presentations etc. see LaTeXiT, Equation
Service and Equation
Editor.
- TeX FoG
If you have trouble remembering all the LaTeX commands for
mathematical symbols you may find TeX
FoG a handy tool. It lets you create the LaTeX code for an
equation by clicking buttons for each symbol you need.
- Grapher i
Tiger comes with a surprisingly capable graphing application. It is
also able to create
LaTeX code for the equations it graphs.
- GLE
GLE has updated its installation
methods to use autoconf - so you should be able to install this by
using the same instructions as for Linux. Just make sure you install
libtiff and libpng using either Fink or DarwinPorts.
- Tioga i
Tioga is
a package written by Bill Paxton for creating figures and plots. It
uses Ruby, PDF and Tex together to produce its output.
- TextWrangler i
As an alternative to emacs (above) or similar text editors, TextWrangler
is getting excellent reviews. It's a cut-down version of BBEdit
- a very powerful but expensive editor. TextWrangler will give syntax
highlighting for most common languages as well as fit in neatly with
OS X (providing features such as asking for authentication to save
over files with restricted permissions).
- SubEthaEdit i
SubEthaEdit is
another text editor with the usual syntax highlighting and other
advanced features, but with one feature you won't find in other
editors - collaborative
editing. This might be useful if you happen to be writing a document
with a coauthor who also has a Mac. You could both edit the same
document at the same time, without having to email back and forth.
Other applications
- The GIMP i
The GIMP image editing tool is available as an OS X application
package, and this is one of the few X11 tools I'd suggest not using
Fink or DarwinPorts for. Gimp.app is a must-have.
- Tofu i
Tofu is an unusual
program designed for reading large chunks of text. Rather than
scrolling downwards it scrolls sideways. It sounds odd, but it works
very well especially on those wide laptop screens. Very useful to have
around for large ASCII text files.
- Calculator i
The OS X 10.3 (Panther) calculator has now been fixed. It's still got
a few peculiarities though. For example, it can't raise a number to a
non-integer power. The OS X 10.4 (Tiger) calculator is more fully
featured - just make sure you run the full-blown application and don't
use the much simpler Dashboard widget.
- Longhand i
Longhand
is a powerful calculator that takes equations you type in and
calculates them as you type. It supports a huge number of functions,
matrices, complex numbers and lets you assign results to variables to
use later. Very useful for quick bits of maths.
- Virtual desktop tools
Leopard of course now has Spaces built in, which provides virtual desktops, but for those using Tiger...
- Codetek Virtual Desktop
Codetek Virtual Desktop
gives you a virtual desktop pager and the pro version has a few extra
features like focus-follows-mouse. There's a 15 day demo but after
that you'll need to pay $40 for it (pro) or $20 (lite).
- Desktop Manager
Like Codetek Virtual Desktop above, Desktop Manager gives you
a virtual desktop pager. It doesn't have some of the features of the
full version of Codetek's product, but it is free software. The
webpage says it's only alpha quality at the moment and I've not tried
it myself.
- VirtueDesktops i
VirtueDesktops is based on
Desktop Manager, and looks like it's getting very popular amongst
those that like virtual desktop applications.
- Space.app
Space.app is another free
virtual desktop manager I've not tried, and doesn't seem to have seen
any development for some years now.
- Adobe Reader
Whilst the built in Preview is very good for viewing PDF files (and
the viewer I use most of the time) the reader
from Adobe has a few extra tricks up its sleeve. For example, it
can search PDFs on your hard disk for particular text, which can be
handy when trying to dig out a reference from a folder full of
papers. The new version of OS X (Tiger) has Spotlight which
can do that sort of search much better, but if you don't have it then this
reader can be very handy to have around. Adobe Reader will also let
you view pdfs from inside a browser window - which again can be handy
if you don't have Tiger which has the ability to do that straight out
of the box.
- Skim
Skim lets you read PDFs
and make notes on them too. Looks very handy.
- Cyberduck
The bizarrely-named Cyberduck is a
nice simple FTP and SFTP program for transferring files. It's also free.
- Fugu i
If you want a graphical frontend to SFTP and SCP Fugu may be what
you're after.
Command line tips
There's a number of commands to link your command line and the OS X
environment. Here's a few very useful ones:
- 'open' will let you open standard file types in the right
application from the command line, for example 'open
paper.pdf' to open 'paper.pdf' in Preview or your default PDF
viewer.
- 'open -a' lets you open a specific application from the
command line, for example 'open -a mail' to start Apple's
Mail application.
- 'open-x11' lets you open X11 applications without X11.app
already running, eg 'open-x11 xclock'. Note - Leopard
handles this automatically now, so no need to use this script.
- 'pbpaste' and 'pbcopy' send the pasteboard (or
clipboard as it is called on other systems) to and from the command
line. For example, to get a word count of a PDF document you could
select all the text in Preview, copy it to the pasteboard and then in
Terminal enter 'pbpaste | wc -w'. Alternatively you might
want to get a text file into the pasteboard quickly using 'pbcopy
< lotsoftext.txt'.
Useful links
Additions, suggestions, comments etc to Edd.