To see what Java versions are installed in OS X
ls -al /System/Library/Frameworks/JavaVM.framework/Versions
Your Java executable – usually ‘/usr/bin/java’ is linked to the instance in the ‘Current’.
ls -al /usr/bin/java
To switch, ‘simply’ point ‘Current’ and ‘CurrentJDK’ to the appropriate version.
A great version of Bash documentation.
Brief notes from my first attempt to use Bazaar and Launchpad.
Launchpad
After creating account, do yourself a favor and do the following:
- In Profile > Personal, specify a short, unique name – it keeps the URLs sane
- In Profile > SSH Keys, upload a public key – that allows you to push changes to your Launchpad
Bazaar
The User Guide is a good place to find answers.
In your local Bazaar setup, do the following:
Specify your default commit information
bzr whoami "Your Name <email@example.com>"
Specify a launchpad login
bzr launchpad-login some_launchpad_login_name
Using Bazaar – A branch per feature
1) Create a mirror trunk from somewhere
bzr init-repo PROJECT
cd PROJECT
bzr branch SOME_URL trunk
2) Create a local branch for a feature
bzr branch trunk some_feature_or_fix
cd some_feature_or_fix
...do something...
bzr commit ...
3) Refresh the (local) trunk mirror
cd trunk
bzr pull
4) Merge changes from local trunk into feature branch
cd some_feature_or_fix
bzr merge
(resolve conflicts)
bzr commit ...
5) Merge branch changes into local trunk
cd trunk
bzr pull
brz merge ../some_branch_or_fix
(resolve conflicts)
bzr commit ...
6) Merge local trunk changes into master trunk
cd trunk
bzr pull
bzr push
Notes on installing Tomcat 5.5 and Magnolia 3.6 CE.
1) Tomcat 5.5
Download the ‘core’ Tomcat 5.5 distribution from the Apache site.
Move zip file to the location where you want to install Tomcat.
Unzip the file
In your (bash) shell, define the two environment variables as appropriate to your system:
export CATALINA_HOME=/Users/tracy/Everything/Downloads/installed/apache-tomcat-5.5.27
export JAVA_HOME=/usr
To start and stop Tomcat
$CATALINA_HOME/bin/startup.sh
$CATALINA_HOME/bin/shutdown.sh
That’s it for Tomcat.
2) Magnolia 3.6.4 CE
The copy of Magnolia 3.6.4 CE I downloaded, contrary to the documentation, is missing the full Tomcat package. So:
cp $MAGNOLIA_HOME/apache-tomcat-5.5.25/bin $CATALINA_HOME/bin
rsync -a $MAGNOLIA_HOME/apache-tomcat-5.5.25/webapps/magnoliaAuthor $CATALINA_HOME/webapps
rsync -a $MAGNOLIA_HOME/apache-tomcat-5.5.25/webapps/magnoliaPublic $CATALINA_HOME/webapps
Textmate – where to find help.
Start with the Textmate Wiki
To change advanced user options in Leopard, control-click on the use name in System Preferences > Accounts.

Leopard - Advanced User Options
In Leopard and SnowLeopard, netinfo is gone. It is replaced by the ‘dscl’ (Directory Services Command Line) suite of utilities:
- dscl – main command-line interface
dscacheutil - lookupd replacement
dseditgroup
dsmemberutil
- dserr
- dsexport
- dsimport
- dsmemberutil
- dsperfmonitor
dscl command examples
Interactive mode – defaults to ‘localhost’
dscl
list /
Specifying a datasource – by default the datasource is ‘localhost’. Other datasources require DS proxy support on the remote host.
dscl localhost list /
When specifying a command, you appear to be able to drop the leading ‘-’. You must execute these as root.
List a specific group.
dscl localhost list /Local/Default
List a specific setting for a specific group or set of entries.
dscl localhost list /Local/Default/Users UniqueID
Create a new entry in the local (/) domain under the category /users.
dscl localhost -create /Local/Default/Users/USER
Create and set the user’s ID.
dscl localhost -create /Local/Default/Users/USER UniqueID UNIQUEID
Create and set the shell property to bash.
dscl localhost -create /Local/Default/Users/USER UserShell /bin/bash
Create and set the user’s full name.
dscl localhost -create /Local/Default/Users/USER RealName "USER REAL NAME"
Create and set the user’s group ID property.
dscl localhost -create /Local/Default/Users/USER PrimaryGroupID GROUPID
Create and set the user home directory.
dscl localhost -create /Local/Default/Users/USER NFSHomeDirectory /Local/Users/USER
Set the password.
dscl localhost -passwd /Local/Default/Users/USER PASSWORD
To disable the password, set it to the two characters ‘\*’.
To create a group
dscl localhost -create /Local/Default/Groups GROUP
dscl localhost -append /Local/Default/Groups GROUP PrimaryGroupID GID
dscl localhost -append /Local/Default/Groups GROUP Password \*
For PostgreSQL, if you’re trying to create a reproducible, almost production-capable installation on OS X there are a couple of things you need to do.
Step 1 – Configure your kernel.
Create or edit the ‘/etc/sysctl.conf’ file to include settings similar to:
kern.sysv.shmmax=134217728
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.sysv.shmall=32768
Reboot!
Step 2 – Download and build PostgreSQL from source
Download from PostgreSQL site.
Unpack and build (standard GNU-style build). Note the location specified for PostgreSQL. This has now become the default.
tar xzf postgresql-8.3.4.tar.gz
cd postgresql-8.3.r
./configure --prefix=/usr/local/pgsql
make
sudo make install
Step 3 – Create a postgres user and initialize the database
All you really need is a non-login account for the postgres user. Do it whatever is your favority OS X way – System Preferences > Accounts works fine.
Create a data directory
sudo mkdir /usr/local/pgsql/data
Change ownership of all the postgresql directories
sudo chown -R postgres /usr/local/pgsql
Initialize the PostgreSQL database (as postgres user)
/usr/local/pgsql/bin/initdb -E UTF8 -D /usr/local/pgsql/data
Start the PostgreSQL database server (as postgres user)
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
Do yourself a favor and add these two optional steps:
- Automate the starting and stopping of the PostgreSQL database
- Install a GUI admin tool. pgAdmin is free and works well.
SpiderOak - an elegant, versioned on-line backup utility. Currently free for up to 2GB of backup space.
I went on the search for something that gives better resolution that OS X Time machine (every hour). Found this elegant tool. Then of course I wanted to automate it.
That turns out to be very simple, and only require two elements.
Part 1
The command to execute a SpiderOAK backup from the commant line:
/Applications/SpiderOak.app/Contents/MacOS/SpiderOak --backup=<somedir> --batchmode
That’s it!
Part 2
This is the newer, ‘approved’ process for creating a scheduled task in OS X. This supercedes crontab.
Create a launchd configuration. Taming launchd provides a good jumping-off place to understand launchd.
I dug around a little, and found by far the easiest way to write launchd configurations is Lingon, a very well-done donateware front-end to launchd.
Screen shots of the GUI setup, followed by the plist file generated.

Lingon - SpiderOAK setup

Lingon - SpiderOAK plist