These are notes on how I set up my mac. I found this useful for my
own recovery when I sent in my old powerbook for a screen replacement,
and unexpectedly got a new macbook pro in return. Having this note
file on my backup disk shortened the restart time.
Useful (?) Links
- Mac Singularity : Marcos
Huerta's site, including his pkg installers for Iraf.
- AstroBetter : a blog for mac-using astronomers
OS X for
Astronomers: Jane Rigby's page.
- OS X for
Oceanographers :
a guide directed at oceanographers and atmospheric scientists, much
of it still applicable to astronomers.
- Scisoft:
a shortcut installation of astronomy software from ESO
(iraf,python,pyraf... and supermongo)
- MacResearch: a blog for
mac-using scientists.
My Setup
This is basically just a log of what I did when setting up software on my Macbook Pro running
Leopard 10.5.x
- End of Caps Lock
First things first: replace the Caps Lock key with Control, as God
intended it to be. Open up System Preferences, Keyboard & Mouse.
Select the "Keyboard" tab, then click on the "Modifer Keys" button.
Change the Caps Lock to "^ Control".
- Switch Shell To Tcsh: ($HOME/)
Open System Preferences > Accounts.
Click the lock in the lower left to enable the Advanced menu.
Ctrl+click on an account name to set the login setup for that
user. You can change Leopard's default login shell, the account's home
directory or short name, etc.
I considered zsh...
but held off on a switch and stuck with the more familiar tcsh.
- Emacs (/usr/bin/ /Applications/)
There are several Mac emacs options I've tried over the years, and I'm
still not sure I'm entirely satisfied with my final solution.
- OS X Native :
Leopard comes with emacs 22.1.1, but no application for carbon
support. In my first emacs attempt, I followed
these
instructions to make an application wrapper around the default
emacs installation. This setup seemed to work initially, but I quickly began to run
into an error every time I tried to open up emacs from the terminal
command line:
> emacs
LSOpenFromURLSpec() failed with error -10810.
- Carbon
Emacs
This is what I'm currently using, and I'm mostly happy with it. I
keep my familiar emacs keybindings, with the command key as my
"Meta" key (and Caps Lock as "Control"). I can copy text
with M-w and then paste it into a Terminal window
with Command-v. I can copy text from Firefox
with Command-c, then yank it into emacs
with C-y.
I made a shell alias in my .tcshrc to use this Emacs.app instead of
the default Leopard installation:
alias emacs 'open -a /Applications/Emacs.app/Contents/MacOS/emacs'
Then from the Terminal I can just type 'emacs' to open up a single
emacs session at dawn. Then I use "C-x 5 2" to get new frames in new
Spaces as the day goes on, and all is well.
One minor annoyance: using that alias from the command
line like this: emacs file.txt doesn't behave as it
should. That should open up file.txt if it already exists, or it
should give me an emacs window with a new, empty file.txt if it
doesn't. It isn't perfect, but I wrote this little
script to solve the problem. Put it in $HOME/bin/,
add a new alias to .tcshrc, and its good enough for me.
- AquaMacs
This is another Mac-specific emacs option, but it is a little too
Appley for my taste.
- Carbon
XEmacs:
a port of XEmacs for the Mac.
- directory structure (/usr/)
OSX does not have a built in /usr/local directory. If you want to
have one as a place to put things that you install yourself, then you
should create it here, use it consistently by setting the install
directory for future installations, and put it in your path so your
programs can be found.
If you use fink for package installs you will get a /sw directory, and
macports uses /opt (see below). It is not a bad idea to keep user
installs in /usr/local so they are separate from your package
installer and OS installation.
> sudo mkdir /usr/local
- Quicksilver (/Applications)
This is essential. If you need convincing, google for it, or listen
to these evangelists:
AstroBetter
43 Folders
Lifehacker
Download and install from BlackTree
Set up triggers for x11, itunes, safari, system pref., emacs, etc
- ssh ($HOME/ /etc/hosts)
Make a ~/.ssh/config file with host names and port numbers of oft-used
remote machines.
Trusted X11 Forwarding:
if you are going to ssh into another machine, and intend to display X
windows locally on your mac, you need to use trusted x11
forwarding. You can enable this option each time with "ssh -Y", or you
can make an alias in your .tcshrc file:
alias ssh 'ssh -Y'
or you can allow it explicitly in .ssh/config :
ForwardX11Trusted=yes
- passphrase authentication
For quick, secure ssh access to favorite machines.
on your mac: ssh-keygen -t rsa1
[enter passphrase]
then scp the .ssh/identity.pub file over to the remote machine, and
append it to the .ssh/authorized_keys file.
DNS issues : ssh from home (at least) is really slow.
No easy fixes found, but it seems to be a DNS issue. Not a leopard
bug, but a problem with my westell 327W router. Two solutions are
available:
a) insert the openDNS addresses into the DNS servers box for the home
setup:
208.67.222.222 (resolver1.opendns.com)
208.67.220.220 (resolver2.opendns.com)
b) insert the ip addresses of the boxes that I want to ssh to/from
into the /etc/hosts file:
128.100.100.100 some_host
128.100.100.101 another_host
I have implemented option (b) for now. I'm not sure I like openDNS.
- Mac Developer Tools (/usr/bin/)
important software dev tools, including the gcc compiler.
Install xCode 3.0 developer toolkit from OSX install disc 2.
(or get an account and download from developer.apple.com)
I did the standard install to /Developer, but in Xcode 3.0 you can
install to a different location if desired.
version 3.0 does not include a fortran compiler. I downloaded the
binary installer from macresearch.
Quick compile test of some old f77 code works ok. Needs to be watched...
- Package installer : fink vs macports
Many OSX installations are easier and smoother if done by hand, but
occasionally you will come across something with a complicated web of
dependencies that you don't want to mess with. In that circumstance
you may want to use a package installer to preserve your sanity. In
MacOSX your choices are fink or MacPorts (nee DarwinPorts).
I've used both, and they can both do the job. As I understand it,
fink is based on apt, so debian fans may like it, macports has perhaps
some closer ties to the mac developers, so apple-lovers may lean that
way. It seems to be mostly a matter of taste. I would recommend just
picking one and sticking with it. From here on out, I'll be using
MacPorts.
- Macports (/opt/local/)
NOTE: BE SURE TO INSTALL THE XCODE DEVELOPER TOOLS BEFORE MACPORTS
Download the dmg installer from www.macports.org and install. Macports
itself will be put in the newly created /opt/local directory.
The installed runs selfupdate for you. Be sure to selfupdate before
doing any future installations.
- rsync backup
Time Machine looks nice, but it can't do backups to a remote network
disk. Carbon Copy Cloner looks like another nice option, but I believe
it has to be a push-based backup, instead of a pull-based backup
(unless your backup drive is a mac running CCC, perhaps).
The best solution for me is to set up a network backup using an rsync
script with passphraseless authentication. Here is
a good
explanation from the Carbon Copy author:
- set up passphraseless authentication from the remote backup host to
my macbook
- set up a shell script that sleeps until my laptop is present on the
network, then rsyncs a full-disk incremental backup.
- file transfer tools
ncftp: a full-featured ftp client (/usr/bin/)
wget: handy for
grabbing files via http or ftp (/opt/)
install via MacPorts
- X11 in leopard
Documented issues with Leopard's X11:
http://forums.macosxhints.com/showthread.php?t=80171
More details : http://homepage.mac.com/sao1/X11/index.html
An open-source X11 project called Xquartz is driving the bug-fixes
that eventually get packaged into OSX updates. Get ahead of the curve
by installing the latest Xquartz binaries:
http://trac.macosforge.org/projects/xquartz
X11 behaves very differently in leopard. See Sao's page above for
details.
- Python
Leopard includes a python installation by default, but you'll want to
add on some useful packages.
The Enthought
Python Distribution is excellent.
It includes ipython, matplotlib, Mayavi, numpy, and SciPy. There are
lots of other libraries included, but with those 5 working smoothly
right out of the box I've got no complaints.
Alternative installation paths:
- Before the EPD arrived, I used
the Scipy superpack for
Mac OS X by Chris Fonnesbeck
Note: this installs a new version of numpy (v1.0.5) to replace the
version that comes packaged with leopard, and the binaries being
installed are based on very recent SVN releases.
You also get a new version of setuptools, readline, and pymc alongside
ipython, matplotlib, scipy and numpy in your site-packages directory.
Everything works except the matplotlib v0.98pre installation.
I wiped away that egg and the egg entry in easy_install.pth, then just
installed matplotlib by hand:
download v0.91.2 .egg from sourceforge:
http://sourceforge.net/project/showfiles.php?group_id=80706
- Using macports:
port search ipython
sudo port install py25-ipython
port search scipy
sudo port install py25-scipy
port search matplotlib
sudo port install py25-matplotlib
but it seems that it doesn't find the system built-ins when searching
for dependencies, so it wants to install,e.g. python-2.5 and numpy,
etc. even when they are already there.
- Using the built-in easy_install:
sudo easy_install ipython
- this seems to work fine... but I found some problems with
readline support. The superpack version updates readline, and
therefore seems to work better.
sudo easy_install matplotlib
- this latter doesn't seem to work.
- but matplotlib has an egg that can be downloaded
- unzip the egg (it will unpack into the cwd, so create a .egg
directory and unpack it from within there)
- put the .egg directory in the site-packages dir so its on the
python path, and then run the sudo command above, giving it the
name of the .egg directory
(you don't want to be downloading anything from sourceforge, so nip
that in the bud if it starts)
- python modules : pyfits
download from stsci
untar and install:
sudo python setup.py install
this puts it in the site-packages directory. Specify
--local="/destination/directory" to put it somewhere else.
- resize and move windows
One of the biggest annoyances of Mac OSX is the inability to move and
resize windows intelligently. You have to grab the title bar to move
it, and the lower right corner to resize. Very inconvenient.
See my
guest post on the AstroBetter blog for info on MondoMouse,
MercuryMover, and other alternatives.