Great, you just bought a new mac to replace your old, sluggish machine that keeps running out of space. Now comes the joy of migrating to a brand new spanking machine. These are the key steps that I took to migrate. In the midst of my journey, I didn’t find one consistent spot which had all the information I needed. So, to help those that may be doing what I did, here are my steps to get my tool stack back up and running….
Step 1: Use Migration Assistant
The mac tools make it easy to migrate from one machine to another and the tool to use is Migration Assistant. There is just one caveat – on your new machine, make sure you run Migration Assistant as part of the install process. This is incredibly important, as it allows the installer to copy the entire user from your old machine to the new – complete with .bash_profiles and .bashrc files and all. If you fail to do this, you can end up in a real mess. I did. In fact, I ran Migration Assistant, and tried to overwrite my current user – bad idea. I had to reinstall Snow Leopard.
Once you have selected the directories to move, let the tool take care of the rest. By in large, you will usually select most things. You may decide to omit Applications (as I did) and reinstall your applications from scratch. This is usually a better outcome.
Step 2: Install Applications
Now you have all your data, you need to reinstall your key applications (TextMate, Quicksilver, Firefox etc). This is fairly straightforward – and will test your memory to find all those license keys you need to reinstall each piece of software!
In this phase, don’t install Postgres using the DMG image as provided on the postgres site. The dmg contains a 32bit compiled version which will run on Snow Leopard but doesn’t work with trying to build libraries against it, since much of the building mechanisms require 64bit libraries.
Step 3: Install XCode 3.2.2
The XCode toolset is required to build any native software on the mac. It comes with gcc and other tools which makes building things from source a lot better. Make sure you get v3.2.2 since the version that ships on the Snow Leopard disk has a bug in it.
Head to http://developer.apple.com/technologies/xcode.html and click on Mac Dev Center -> XCode 3.2.2 and iPhone SDK 3.2. If the link sends you into a spin (it did for me), then go the iPhone Dev Center and click on the same link. You just need XCode 3.2.2. You will be required to register in order to download the SDK. Once you have it, install it.
Step 3: Re-install MacPorts and Install Postgres8.4
I had MacPorts running on my previous system. That won’t do you much good now if you’re coming from a 32bit environment. To remove MacPorts, run this:
This will remove the MacPort binaries. Head over to http://distfiles.macports.org/MacPorts/ to download the MackPorts-1.8.2-10.6-SnowLeopard.dmg file and install that. Then install the following:
This will download the dependencies, and the source files, compile and build the binaries appropriate to the current OS platform you are running. Installing wget gives you the similar tools on unix (it’s a curl equivalent). It also installs a number of useful dependencies. At the end of the install, you will need to run the following to complete the installation.
Create the postgres user (if you haven’t got one already) and run the following to setup the defaultdb for postgres:
sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb
sudo chown postgres:postgres /opt/local/var/db/postgresql84/defaultdb
sudo su postgres -c '/opt/local/lib/postgresql84/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb'
Then you will need to install postgres as a service:
Edit your shell profile and append postgres binaries to your path. The binary files live here:
Now fire up postgres as a service by running:
To test postgres is install and running propertly, first, ensure that your current user has administrative privileges over postgres, run the following:
Then test that you can create a new database:
You should see positive confirmation that you could login to the test_db instance. Now drop the database:
The last statement should show that there is no such database called ‘test_db’.
Step 5: Install RVM
RVM is a tool which allows you to switch between ruby environments. I use to do my own hot switching using symlinks and shell commands, but this tool takes care of everything in a very neat package.
The RVM install is relatively straightforward. I chose to install it as a user, making it easier to remove if required. I followed the RVM installation instructions as provided, with the following notes:
- I installed it as a user – to make it easier to remove later if required.
- I had to alter my .bash_profile and just appended the command to source $HOME/.rvm/scripts/rvm
Step 6: Making TextMate use RVM
My editor of choice is TextMate, which has internal support for Ruby and for running Ruby Unit Tests. Most of this magic requires you to tell TextMate where your Ruby runtime is, and the rest works fine. This causes TextMate to require the right files, and you should then be able to run Ruby tests directly with TextMate using CMD-R.
However, TextMate wasn’t really “designed” to handle multiple Ruby runtimes easily. Thankfully, as of 0.1.45 of RVM, you can simply get TextMate to point TM_RUBY to a pre-specified script.
There were two key things that need to do to get TextMate to play nice:
- Set TM_RUBY to ~/.rvm/bin/rvm-auto-ruby
- Rename /Applications/TextMate.app/Contents/SharedSupport/Support/lib/Builder.rb to something else
These TextMate-RVM integration instructions provide the detail of what needs to be done.
After all that, you’re done! Snow Leopard, PostgreSQL, RVM and TextMate all under one roof.