Mac OS 10.5 (Leopard) for astronomers


MacOS 10.5 - Leopard. Apparently Steve Jobs wants us all to buy iPhones.
My money is on OS 10.6 being called Lynx...
A long-time Mac user, I recently upgraded my laptop from a G4 PowerBook (OS 10.3.9) to a shiny new MacBook, complete with a new Intel processor (or two) and Leopard (10.5.2). Installing everything again was a bit of a hassle (it took the better part of a day), so I decided to keep track of what I did. I've posted it here in the hope that it may help anyone else who finds themselves in the same situation.

Please note that several other (better) sites exist to aid non-Mac-fluent astronomers. (Especially good ones have been written by Jane Rigby, Edd Edmondson and John Vernaleo.) Also, almost any problem can that isn't specific to astronomy stuff can be solved by consulting either the discussion forums on apple.com, or the excellent Mac OS X Hints. This is just a personal log of my Leopard set up, so that: a) I can remember what I did (in case I break anything); and b) I don't keep having to re-write the same email to send to people when they ask for help. I offer no guarantees that this will work for anyone else. In particular, please note that my system came with Leopard installed; I didn't upgrade from Tiger. I don't know how previously installed non-Apple software (Fink, etc.) will respond to a Tiger-to-Leopard upgrade.

One major point to note to begin with is that X11 (the X-window system) is installed by default in Leopard. This wasn't true of Tiger or Panther, and saves a few steps in the set-up process. It's worth downloading the most recent patches, however, as several bugs are present in the version on the Leopard disks. (I started with XQuartz v2.1.4; I currently have v2.3.3.2.) In particular, the three-button mouse emulator (which allows you to paste on to the command line using Option-Click), is missing from the basic version. If you're used to using this, its absence will drive you insane in approximately seven seconds. Once you have the update, go to X11 -> Preferences, and enable the three-button mouse emulator.

One last introductory comment: Leopard appears to take up quite a bit of disk space. My old machine had a "60Gb" drive (actually about 57Gb in practice), and it was completely full. I copied all of the data from it to the new machine, and am using what is essentially an identical set-up. (Everything listed below was installed on both machines.) My initial set-up used about 66Gb on my disk, so it appears that my Leopard set-up has swallowed up about 9Gb more disk space than the same set-up did under Panther.

[UPDATE: I recently upgraded to the latest Leopard release, 10.5.3. No problems so far, but I did have to re-install XQuartz, as the update over-writes it with the Apple version of X11.
I've now upgraded again, first to 10.5.4, then to 10.5.5, 10.5.6, 10.5.7, and now to 10.5.8: no problems have been found so far.
There is, however, a known issue with PGPlot and all versions of XQuartz later than v2.3.1 - a fix is listed in the PGPlot section below. (Also, the new versions of X11 have a much cooler icon than the old ones.)]

Basics and new features

If you're new to Mac, just fire it up and follow the instructions. Once you're logged-in you should be able to follow most of the instructions below.

If you're upgrading to a new Mac from an older one, you will be prompted to copy data from the old computer during the intial start-up phase. I strongly recommend doing this - it's astonishingly simple. Don't transfer everything from Applications or the system folders (unless you're sure that the binary files are compatible), just the user accounts. Mine successfully transferred everything, from data files and email accounts right down to stored web passwords and the ssh cache. With a 400Mb/s FireWire connection it took about 1 ½ hours to transfer 45Gb of data (much of which was in small files). Only two minor problems have cropped up so far:

  • It imported the Dock, but as I didn't import the Applications (because they wouldn't have worked) most of the links were dead. Just clear everything off the Dock and set it up again.
  • The ssh cache was imported from the old machine. Unfortunately this means that the certificates won't match if you try to ssh to any system you used before! Delete ~/.ssh/known_hosts and you should be fine.

    Firewall

    Leopard has a new firewall system, which operates on a different basis than previous incarnations (it's socket-specific rather than port-specific). I don't really understand the details, but a decent explanation of how it works is here. To activate it, go to System Preferences -> Security -> Firewall, and select the option you want. At the moment I'm running the "Only allow essential services" option, with "Stealth Mode" on (Advanced button). Haven't had any problems with this yet, but I guess I'll see how it goes.

    Spaces

    New in Leopard is Spaces, a long-overdue utility that allows the use of virtual desktops. Previously I was a very happy user of the excellent Virtue Desktops, so I'm glad to see something similar make its way into OS X. (Virtue is sadly no longer supported, and doesn't appear to work under Leopard.)

    Activate Spaces by going to System Preferences -> Expose & Spaces -> Spaces, and clicking the appropriate button. You can then set up the layout and shortcut keys how you want - the maximum is 4 rows of 4 columns (though I can't imagine why anyone would need 16 desktops). First impressions are that it's a bit clunkier than Virtue. No big issues, but a couple of minor niggles:

  • Individual applications are limited to a single "Space". Seems sensible at first, but if you are running X11 with a lot of open windows it's often preferable to spread them over several desktops.
    [UPDATE: After several "sort-of" fixes, this bug was finally fixed in v10.5.7. It's now possible to spread all applications over multiple "Spaces", even X11.]
  • There doesn't appear to be a way to turn off the animated transition when you switch between desktops. Pretty, but ultimately a bit annoying.

    Time Machine & backups

    One of the major new developments in Leopard is the automated backup utility Time Machine. However, it's more than just a backup utility - it keeps a record of all your file changes, so you can recover any old revision of any file. It's designed to allow easy recovery of accidentally deleted files, and seems to do its job well. Also, the interface looks cool. (As an aside, any OS-based utility that helps people to back up more often can only be a good thing. Now may also be a good time to buy shares in companies who make external hard drives.) It's really simple to use too. It jumps up when you connect an external hard drive, and if you open System Preferences -> Time Machine you will find just two buttons: "Choose backup disk", and a giant sliding switch to turn Time Machine on or off.

    However, at present I have a couple of objections to Time Machine. First, it's really slow, much slower than just drag-and-drop copying. More importantly, however, the historical backup has the potential to swallow up vast amounts of space on an external drive. Every time I use my computer for work I change lots of files, and often they're things that really don't need backed-up (if I re-compile a Unix package, for example). My external hard disk is the same size as my internal one and I maintain more than one backup of truly essential stuff, so all I really want is to mirror the drive. Consequently, until Apple add some more flexibility to Time Machine I will continue to use the excellent iBackup instead, which provides a quick and simple interface to back up everything I want to. Even better, it allows for multiple backups: I have a "main" setup that backs up everything to my external hard disk, and a "quick" setup that backs up a smaller sub-set of stuff to my iPod (useful when travelling). I'll probably wake up Time Machine every now and again though, if only to look at the interface...

    iTunes

    Not really astronomer-specific, but worth remembering anyway. If you have any music that was bought from the iTunes store, remember to de-authorise your old computer before you get rid of it. (iTunes only allows 5 computers to be authorised to play music bought on any single account. If you upgrade regularly without de-authorising the old machines, eventually you won't be able to listen to your music.) Go to Store -> Deauthorize Computer, and follow the prompts.

    Printers

    The Add Printer Utility is no longer in the Applications -> Utilities folder. Instead, go to System Preferences -> Print & Fax, and click the + button to run the Add Printer wizard. The interface looks a bit shinier than before, but it works in exactly the same way. (Also, the highly irritating bug in Panther that screwed up printer addresses with "folders" in them - printers/lp2, for example - seems to have been fixed. Previously the only workaround was to log in as root and manually edit the printer list file, then re-start the CUPS daemon. I've been told it was actually fixed in later versions of Tiger too though.)

    [UPDATE: Over time, I've found that it is still sometimes necessary to restart the CUPS daemon when dealing with network printers, especially if the printer has just been restarted. Type sudo killall cupsd to stop the daemon, and then sudo /usr/sbin/cupsd to restart it. There's probably a more elegant Mac way to do that, but this seems to work OK for me.]

    Batteries

    One of the most common problems with Mac laptops seems to be the batteries - my old PowerBook battery was replaced under one of the free recalls, but after a couple of years the new one performed less than optimally. Coconut Battery is an excellent little utility that allows you to monitor the health of your battery, and even allows you to save the data in order to see how the capacity declines over months and years.

    Cases

    I recommend getting a Tucano Second Skin. Doesn't cost much, and does everything asked. I had one for my old PowerBook, and it was sufficiently good that I've got a new one for my MacBook.


    Essentials

    Below are brief set-up instructions for the various bits of software that are absolutely essential for astronomers. Further down is a list of less critical things that you may or may not decide to install.

    TeX

    Go with the excellent
    MacTeX. Trivial to install, and comes with all the bells and whistles (including TeXShop and the Keynote-compatible LaTeXIT utility).

    Also, the if you want to track revisions of documents (or submit to journals who ask you to highlight changes in revised versions), then you should get the excellent LaTeXDiff programme. (You also need the Applescripts latexdiff.scpt and setnames.scpt from Claus Gerhardt.) Install it as a macro in TeXShop - the only tricky part is actually finding the path to the LaTeX executable. MacTeX put mine in:
    /usr/local/texlive/2007/bin/i386-darwin/latex
    (although it's actually a symbolic link to pdftex). The output it produces is very similar to the "redline" copy of the manuscript that ApJ send with their proofs: strikeouts in red, new text in blue, etc. A very simple way to impress co-authors...

    UPDATE: As someone who writes for both European and US journals, I have found one small "bug" in MacTeX - by default it always produces A4-sized PDF files, even if you use the "letterpaper" option in the TeX file. The reason, apparently, is that the internal dvipdf command assumes a fixed paper size (A4, unless you request otherwise at installation), regardless of what's in the TeX file. The .dvi files are correct (you can verify this using xdvi from the command line), but the subsequent PDF or PS files are not. After some Googling, I discovered that the commands
    sudo texconfig-sys paper letter
    sudo texconfig-sys dvips paper letter
    change the settings to US Letter paper, and
    sudo texconfig-sys paper a4
    sudo texconfig-sys dvips paper a4
    change it back. (The second of the two commands may or may not be necessary, depending on what version of MacTeX you have installed. You may also have to add /usr/texbin/ to your path to make these commands work properly.)
    It's a bit of a hassle, but if for some reason you need to create PDFs for the "wrong" transatlantic paper size, you can. (Note: make sure that the paper size in the LaTeX file matches this "hard-wired" setting. If it doesn't, the margins won't be centred correctly.)

    Emacs

    Several options exist here, all simple to install. I went for this one; others prefer Aquamacs. Personal preference, really. My only gripe is that all the new versions I can find use the GUI to open files (unlike the old Panther implementation, which used the command line just like a "true" Unix/Linux version). Unfortunately this means you can't open dot files, because dot files are always hidden in the OS X GUI. Currently I'm limited to using the command-line version of emacs to edit things like .tcshrc - news of a fix would be welcome.

    X11

    As mentioned above, X11 itself is installed by default. However, the "Developer Tools", which include various useful things and, crucially, the gcc compiler, are not installed as standard. Insert the second Leopard DVD and follow the prompts. (Note that this takes up about 3.5Gb of disk space.) You may also want to install gcc3.3 - the standard is now gcc4.0.

    Root account, shells, etc.

    These have moved! To enable root access (su), open the Directory Utility in Applications -> Utilities. Click the padlock to unlock it, then go to Edit -> Enable root user. System managers will disagree, but I reckon it's probably a good idea to take a note of the root password and keep it in a safe place.

    The default shell is still bash. If, like me, you prefer tcsh, go to System Preferences -> Accounts. Click the padlock to make changes, then Control-Click on the user whose shell you want to change. Select "Advanced Options", and change the login shell as desired. You have to log out and log back in again in order for the change to take effect.

    Fink

    Fink (along with the similar MacPorts) is by far the easiest way to maintain a standard library of Unix software on a Mac. Unfortunately there isn't, as yet, a binary (i.e. pre-compiled) distribution for Leopard, but installing from source is easy - just follow the instructions on the website. I followed them down to the fink selfupdate-cvs command (rsync is not supported under Leopard yet), then fired up the Fink Commander and did everything else through the GUI. My choice of packages to install is g77, gfortran, ghostscript, gv and PGPlot (see below); choose what you want and click away. At present, my Fink distribution (/sw) takes up around 850Mb on disk.

    The only nag is that installing from source is much slower than installing binaries. The initial setup took about 45 minutes, and some subsequent package installs have taken even longer. Hopefully the binaries will be available soon.

    UPDATE: As of July 2008 there is a binary distribution for Leopard, and rsync updating is also supported. So far so good...

    iWork

    Apple's iWork is the only commercial (i.e. non-free) software I've ever had on a Mac (apart from IDL), and it's invaluable. It's not expensive (especially when compared to MS Office): under $100, and significantly cheaper if you can get an educational discount. The current version comes with Keynote, Pages and Numbers, and it's worth the price for Keynote alone. (Keynote is much better than Powerpoint, in every possible way.) I use Pages only occasionally: quick letter-writing, and to look at the Word files that non-astronomers sometimes use. In the past I have used it to make excellent posters though (excellent in appearance, if not necessarily in content). I haven't used Numbers at all yet, but apparently it has limited Excel compatibility (for those with masochistic tendencies).

    Widgets

    One of the nice features of Leopard (and Tiger) is the Dashboard, an the "widgets" that you can install there. Everyone has their favourite widgets, but some are especially useful for astronomers: there is an ADS search widget, and also one that displays arXiv.org listings.




    Optional bits and pieces

    By all accounts, the preferred option for observers is simply to install ESO's Scisoft package, which includes IRAF, MIDAS, Python, SuperMongo, PGPlot and lots more. However, theorists like me don't really need all that (and don't want to waste the disk space), so instead I just went for a pick-and-choose appoach for the packages I need.

    PGPlot

    For various reasons I still believe that
    PGPlot is by far the best plotting package available. You can download and install it manually from the PGPlot website, but it's easier to install it via Fink. (Note: PGPlot is listed as an unstable package in Fink, so you have to turn unstable packages on in order to install it.) Installing it from source took over an hour, but it passed off without a hitch. Less simple was working out how to compile my scripts, but the following works for me. (Note that I usually code in C - Fortran users should omit the second and third steps, and remove the -lcpgplot library link. Note also that the fink package info will list the correct library links for your system, which may differ from mine.)

  • Set the PGPLOT_DIR environment variable. I have
    setenv PGPLOT_DIR /sw/lib/pgplot/
    in my .tcshrc file.
  • Include the PGPlot header file at the top of your code:
    #include "/sw/lib/pgplot/cpgplot.h"
  • Compile the C code, using:
    gcc -c prog.c
  • Compile the executable, using:
    gfortran prog.o -o prog.e -lm -L/usr/X11R6/lib -lX11 -L/sw/lib -laquaterm -Wl,-framework -Wl,Foundation -L/sw/lib/pgplot -lcpgplot -lpgplot -L/sw/lib -lpng -lz

    I have a short script in my home directory that executes the latter two commands, and then cleans up by removing the prog.o file. An alias in my .tcshrc file then allows me to compile using a single command. You may also want to change the default graphics device by setting the PGPLOT_DEV environment variable to the device of your choice (/xs, /ps, etc. - the default is /null).

    UPDATE: There is a known issue with PGPlot and new versions of XQuartz (v2.3.1 or later). The new XQuartz versions use improved colour rendering, and this causes a conflict with default behaviour of the PGPlot X-Window graphics device (/xw or /xs). The PGPlot window initially appears as normal, but doesn't update for any subsequent plotting. There are two possible solutions to this, depending on your requirements:

  • The first solution is to turn on 256-colour mode in X11 -> Preferences -> Output. (You have to restart X11 for the change to take effect.) However, this disables more complex colour behaviour in other applications (IDL, for example), so I found that it isn't an ideal solution. (Credit for this fix goes to the XQuartz help forum.)
  • A better solution is to force the PGPlot Graphics Server (pgxwin_server) into TrueColor mode. This can be done manually (using the command pgxwin_server -win_visual truecolor & before calling PGPlot), but a more elegant fix is to change the default behaviour of the device. To do this you create a file named .Xdefaults in your home directory, and include the line
    pgxwin.Win.visual: TrueColor

    This works fine for me, and doesn't seem to mess up any other programs. If all else fails though, reverting to an older version of XQuartz should also do the trick.


    Parallel Processing - OpenMP

    As the new Macs use dual-core processors, jobs run from the command line will usually only make use of 50% of the CPU capacity available. However,
    OpenMP provides a simple means of parallelising existing code to make use of the full processor capacity. The current Apple compilers (gcc-4.0.1) do not support OpenMP, but more recent versions of the GNU compilers do. I installed gcc-4.3.0 through fink, and the OpenMP support appears to work perfectly. (Note that the compiler flag is -fopenmp when using the GNU compilers.) In particular, my (non-public, messy) OpenMP-parallelised version of ZEUS-2D compiles and runs on my laptop using gfortran (4.3.0) without any problems (also using the fink-installed HDF4 libraries).

    One point to note is that if you plan to do this a lot, you will probably need to set up an alias to avoid using the non-OpenMP-compliant Apple compilers. By default gcc calls v4.0.1; the fink version is /sw/bin/gcc-4. Something like:
    alias gcc43 /sw/bin/gcc-4
    in your .tcshrc file ought to to the trick. OpenMPI is also available through fink, but I haven't set it up. (Anything I plan to run using MPI is going to need significantly more CPU power than my laptop has!)

    Fugu

    Fugu is a GUI front end for SCP, SSH and SFTP - very useful when working remotely.

    Gimp

    Gimp can be installed through Fink (for command-line access), but I prefer the native OS X version, available here.

    GraphicConverter

    Lemkesoft's GraphicConverter is a wonderful tool for handling images: I find it especially useful for format conversions (PS -> GIF, etc.), and it's my primary tool for making animations from series of snapshots. (All of the movies on my animations page were created in this way.) It used to be included in the OS X standard software bundle; it's now shareware, but well worth the price.

    Papers

    Papers, from Mekentosj, is a wonderful tool for organising the enormous PDF library that exists on my laptop. It's linked into ADS and arXiv (and lots of other non-astromomy databases), and markets itself as "iTunes for your PDF files". It's shareware, but well worth the money. (Incidentally, "Mekentosj" is a much funnier name if you speak a little Dutch.)


    Splash in action. Incidentally, to take a screenshot press Command-Shift-3.
    Command-Shift-4 takes a shot of the active window.

    Splash

    As a regular SPH user I can't speak highly enough of Dan Price's Splash package, which makes rendering SPH data wonderfully simple. (Among other things, I used Splash to make the beautiful image of a fragmenting disc that adorns my homepage.) In the past I've had some issues getting Splash set up properly (especially on 64-bit machines), but this time it worked perfectly first time. I used the Fink-installed version of PGPLot (see above), and found that it worked using the SYSTEM=gfortran_macosx standard configuration. The only modification I had to make to the Makefile was to change the PGPLOT library variable to that given above - after that it compiled and worked without any problems.

    IDL

    Installation is trivial; obtaining a license is not...

    Random Unix bits and pieces

    I find the following very useful in .tcshrc:
  • set prompt="%m:%c> " - turns the command line prompt into something useful. You may also prefer %~ instead of %c.
  • set nobeep - turns off the infernal error beep.
  • This isn't really a Unix, or even a Mac thing, but it's worth noting. Google's "improved" homepage now automatically uses the new "Google Suggest" feature, where the search-box tries to guess what you're typing. I find this intensely annoying, but no browser setting (in Firefox) will disable it. (The instructions on google.com for turning it off don't work.) The only solution is to replace your Google bookmark with http://www.google.com/webhp?complete=0&hl=en. (Alternatively, use one of Google's international sites - the Suggest feature hasn't yet spread beyond google.com.)
  • Every now and again I need to combine one or more PDF files into a single PDF, usually in order to send things by email. This command:
    gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=file3.pdf -c save p op -f file1.pdf file2.pdf
    uses Ghostscript to combine the files file1.pdf and file2.pdf into a single file, file3.pdf.

    Screen Savers

    Although they're pretty most of the Apple screensavers tend to be quite CPU-intensive, which isn't ideal if you're running programs. There's a simple "blank screen" screensaver available here, or alternatively you can make your own.

    Keyboard notes

    Depending on where your computer was bought, the keyboard layout will be subtly different. In particular, the generation of currency symbols differs between US and British keyboards (also probably on European ones, but I have no experience of those). It's especially problematic if you're British, because either the £ (currency) or # (lots of uses) won't actually appear anywhere on the keyboard, depending on whether you have an American or British keyboard respectively. You can change the keyboard mapping (UK, US, Canadian, etc.) using System Preferences -> International, but then you risk ending up in the somewhat confusing situation where what's written on the keys isn't actually what they do. Anyway, here's the summary:
  • British keyboard map: Shift-3 = £, Alt-3 = #, Alt-2 = Euro symbol.
  • US keyboard map: Shift-3 = #, Alt-3 = £, Alt-Shift-2 = Euro symbol.


    More to be added in due course. Maybe.
  • Return to homepage.


    © Richard Alexander. Last updated April 2009. Site Meter