Creating a better environment from a fresh OS X reinstall

(October 6, 2008)

I'm an environmentalist (in the computer sense), meaning I'm a bit OCD about how things on my machines are organized, etc. I decided to write up the main steps I took after doing a fresh reinstall of OS X a few days ago.

This doesn't cover basics such as installing all applications you use, but rather only the stuff that I would tend to forget when doing a reinstall. Most of the .app's I use are listed on iusethis (thanks to Appfresh, which also keeps them up to date) and here is a list of my installed MacPorts packages.

Initial steps

$ sudo visudo
# Change the %admin line to %admin ALL=(ALL) NOPASSWD: ALL

System Preferences

Install Quicksilver

Clean up the Dock

Install audio / video codecs

Install Xquartz

Install TerminalColours

Terminal.app preferences

Install MacPorts

$ port
# If it says command not found add the following to ~/.bash_profile
export PATH=/opt/local/sbin:/opt/local/bin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH

# Sync and check for any MacPorts updates
$ sudo port -v selfupdate

Install Python

$ sudo port -v install python25 py25-bsddb py25-bz2 py25-curses \
                       py25-gdbm py25-hashlib py25-readline \
                       py25-socket-ssl py25-sqlite3 py25-zlib
$ cd /opt/local/lib/python2.5/site-packages/
$ for x in *.so;
    do sudo ln -s /opt/local/lib/python2.5/site-packages/$x \
                  /opt/local/lib/python2.5/lib-dynload/$x
    done
# The above fixes a MacPorts quirk that breaks virtualenv

Install ack

$ wget http://ack.googlecode.com/svn/tags/latest/ack-standalone
$ sudo mv ack-standalone /opt/local/bin/ack
$ sudo chown root:admin /opt/local/bin/ack
$ sudo chmod +x /opt/local/bin/ack

Add ssh passphrase to Keychain

# This assumes you already have your private key in ~/.ssh
$ /usr/bin/ssh-add -K

Symlink /home to /Users

$ sudo vi /etc/auto_home
# Comment out the +auto_home line

$ sudo vi /etc/auto_master
# Comment out the /home line

$ sudo umount /home
$ sudo rm -rf /home
$ sudo ln -s /Users /home

Install PostgreSQL

$ sudo port -v install postgresql83 postgresql83-server
$ sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb
$ sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb
$ sudo -u postgres /opt/local/lib/postgresql83/bin/postmaster -D \
                   /opt/local/var/db/postgresql83/defaultdb

# Tune sysctl
$ sudo vi /etc/sysctl.conf

# Add the following
kern.sysv.shmmax=536870912
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=16
kern.sysv.shmall=65536
kern.maxvnodes=1000000

Disable writing .DS_Store files on network mounts

$ defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Enable developer tools in Safari

$ defaults write com.apple.Safari IncludeDebugMenu 1
$ defaults write com.apple.Safari WebKitScriptDebuggerEnabled -bool true
$ defaults write com.apple.Safari WebKitDeveloperExtras -bool true

Only show running apps in the dock

$ defaults write com.apple.dock static-only -bool TRUE

Open Targeted links in tabs, not windows (Safari)

$ defaults write com.apple.Safari TargetedClicksCreateTabs -bool true

Show filesystem paths in Finder

$ defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

Firefox settings

# In about:config I set the following options
browser.search.openintab = true
network.proxy.socks_remote_dns = true

Snow Leopard font hint fix

$ defaults -currentHost write -globalDomain AppleFontSmoothing -int 2

Fin.