Notes
These are notes about setting up various astronomy software and Python installations on Macs. Collected here for myself and other lost souls.
New Setup under 10.7
I have just recently set up a new computer under 10.7, starting from scratch. Here is what I put on the machine, ranging from very easy to more complex installations
Complicated Installs
Scisoft for Mac OS X: Scisoft is a useful huge package of astronomy programs, libraries and utilities. I don't need all (or most) of this package, but it's useful to have around. The installation and setup is easy. I installed version Scisoft_OSX_macintel_2012.8.1.pkg and following the inspiration of the Urania blog, I updated the DS9 installation to version 7.0.2, for the cropping, save-and-restore and 3D visualization mostly. I also followed the advice to make an alias to load the Scisoft packages only when needed, making it easier to function with another Python distribution by adding this to my .profile (using BASH):
alias load_scisoft=". /usr/local/scisoft/bin/Setup.bash"
Important (to me) programs in the Scisoft for Mac OSX distribution include WCSTOOLS, IRAF, CFITSIO, and the Astromatic Software Tools (SExtractor, SWarp, ec.). In this version of Scisoft for Mac OSX, the installation directory is /usr/local/scisoft.
DS9 The latest versions of DS9 on the Mac are no longer self-contained Mac applications. I'm not sure what the latest version that supported this mode was, but it is now significantly out-of-date. The latest versions are only released as X11 versions. This is fine, in most cases, but it is annoying because you can no longer double-click on a FITS file to open it. I fixed this by creating an Automator application to run DS9 with an input file, and then telling the Finder to open all .FITS files with this Automator application.The key steps are as follows:
- Launch Automator
- Choose a document type as "Application"
- Choose an action: Library>Utilities>Run Shell Script
- Set the shell appropriately. My example is for bash.
- On the right-hand field called "Pass inputs", select "as arguments".
- Modify the code as follows:
. /usr/local/scisoft/bin/Setup.bash for f in "$@" do echo "$f" cd "$(dirname "$f")" ds9 $f done
The first line here intialized the Scisoft environment so that the script can find DS9. Automator scripts seem to run in blank profile -- none of your setup files in your own profile have any influence. If you had DS9 installed somewhere that is always in the default path, you would not need this step. In the rest of the lines, DS9 sessions are launched for all the input files (in this case, it will be all the FITS files your double-click) with the current directory set to the directory of the file (without this, the working directory for DS9 defaults to the home directory). - Save this as an application somewhere permanent. I called mine DS9.
- Find a .FITS file and "Get Info". Choose to open this file with your automator application, and then hit the "Change All..." button underneath.
ln -s /usr/local/scisoft/bin/ds9 /usr/local/bin/ds9 ln -s /usr/local/scisoft/bin/ds9.zip /usr/local/bin/ds9.zip
to always put ds9 in my path. This works poorly with multiple FITS files. DS9 opens for the first one, and then loads the second one when you close the first DS9 window.
Enthought Python Distribution (EPD) EPD is a scientific distribution of Python with most of the useful/difficult-to-compile packages you might want to use for astronomy pre-compiled. It is free with an education e-mail address. Important packages are ipython, matplotlib, numpy, scipy, PIL, and pyfits. I installed version 7.3, which is Python 2.7.3. EPD configures your startup scripts so that its version of Python is the default, and things like pip and easy_install install into the EPD directories.
Python Packages. The astropy project is coming along, but does not yet contain particularly useful packages for me. Therefore, I need to install things by hand. I attempted to install aplpy using the auto_install.py script at the aplpy homepage but ran into a problem. One of the required pacakges is pywcs, which is not part of EPD. pywcs needs WCSLIB, which (oddly) is not part of Scisoft, but out-of-the-box WCSLIB does not build under 10.7 (actually, out-of-the-box nothing builds on 10.7, but you can get the Apple Developer tools for free from the App Store and find the sort of hidden option to install command line tools). The problem seems to be a bug in Apple's version of GCC. CLANG works, however, so you can do
export CC=CLANG sudo python auto_install.py --stable --extra
to actually get things to work. The --extra tag tells the script to instal atpy and vo as well. This script gets a bunch of useful astronomy python stuff installed.For the rest of the python packages I want, there is a choice between easy_install, pip, and manually installing packages. I went with pip, getting the get-pip.py script from pip-installer and then running sudo python get-pip.py to put it into the EPD Python installation. Yes, in theory I could have followed the recommendations and installed virtualenv instead, but since virtualenv is an admission of how complicated and borked Python installation and maintainence is, I thought I should suffer instead.
Now, in theory, installing new packages will simply be a matter of
sudo pip packagename
and everything will work well under EPD. This leaves the Scisoft Python distribution as the abandoned orphan stepchild distribution. pyds9 and astLib installed easily by-hand using the normalpython setup.py install
Kvis Karma is now in maintainance-only mode. Following the README I grabbed karama-1.7.20-x86_64_Darwin-11.2.tar.bz2 from the ftp site and threw the contents in ~/Applications and added a symlink to this location as speficied in the README. I was not able to use the .karmarc file to set up the environment. This file existed, but was blank. Instead, I added the following to my .profile:
PATH="/usr/local/karma/bin:${PATH}" export PATH export KARMABASE="/usr/local/karma"This seemed to work, except I could not display axis labels. I also need to grab karma-1.7.20-common.tar.bz2 and replace the dummy symlink share with share/ from this folder (this contains the fonts). There were a bunch of other dummy symlinks present as well, so I replaced them with the real folders from the above common file. Everything works now.
Montage. Fairly simple installation. Download, make, and then add to path (no make install is defined?). I put version 3.3 in ~/Applications.
ASAP After failing to install ASAP manually (following these instructions) because of difficulty getting casacore installed, I realized that there as a short-cut and that a full version of ASAP is under the nicely-maintained CASA. This aborted attempt left me with gfortran installed in /usr/local/bin/gfortran (this is gfortran binary 4.6.2 from gcc.gnu.org), rpfits stuff installed in /usr/local/ subdirectories, and another copy of wcslib (4.15) in /usr/local/lib. The first two, at least, are useful. I suppose I also have cmake installed now (required for casacore, but not used successfully).
CASA This was a very easy installation on 10.7. Drag the application to /Applications and then double-click and it completes installation on launch. ASAP commands are under the package sd, so old_asap.command is now sd.old_asap.command.
FUSE/SSHFS I use FUSE and SSHFS to mount external ssh servers as local volumes. Installation is pretty straightforward package installers. Mount commands for my various servers can be defined as aliases. See this page for examples.
Mount
mkdir ~/mountpoint sshfs user@some-host.net:/home/user/ ~/mountpoint -oauto_cache,reconnect,defer_permissions,negative_vncache,volname=somename
Unmountumount ~/mountpoint
Easy Installs
Textmate 2: My text editor of choice. The alpha of Textmate 2 is quite stable, and is now open-source on github as well. I have a license for Textmate 1, so I was able to just download the Textmate 2 binary, enter my registration code, and begin editing files (such as this one).
Launchbar: Another personal choice. There are many fine launchers on the Mac (Alfred, Quicksilver), but I like Launchbar, and I bought a copy once upon a time.
MacTeX-2012: The best choice for LaTeX on the Mac. Simple (large) package installer, which includes applications like BibDesk, TeXShop, and LaTeXiT (plus some others I don't use).
iTerm2: Sure, the default Terminal in MacOSX is fine, but it lacks the features, flair and large memory requirements of iTerm2.- Inkscape
- OmniGraffle
- OmniGraphSketcher
- GraphClick
- The Unarchiver