Wednesday, July 29, 2009

How to get Chromium / Chrome Nightly Builds on Mac OS X

Google Chrome has been out as a public release for quite some time for Windows, but hasn't been available as a release for the rest of us, that is, Linux and Mac users. You might have heard is blazing fast. Luckily, since Chrome is just Chromium with official Google branding tacked-on, its available in source-code form which you can check out and build. This is a tedious process however; the build takes hours to complete from scratch on my Macbook. The upside is that the process can be automated on your Mac with some scripts that run automatically to pull the latest revisions, and recompile and build Chromium.

Then there is the so called alpha "release", which is nothing more than the binaries from a snapshot of their main tree, and which is by now a really old revision which doesn't do many useful things. As I last recall, this revision couldn't correctly copy and paste, keep bookmarks, or do any other non web-browsing function. Clicking around the web worked; nothing else did. Did I mention it was blazing fast? You know how when you start Firefox, the icon jumps up and down 8-10 times in the Dock while it loads? Chromium doesn't have time to make a single jump. Pages load faster than on Firefox for sure, and I like the interface better than WebKit nightlies or Safari proper.

Then, today, I found the Chromium project buildbot. My little bit of reading up on buildbot during my final days on the NS3 project told me this was the trick. If you don't know, buildbot is a system which automatically builds / compiles software from source then runs unit tests, regression suites, etc. on the code base to make sure there have been no regressions. It's highly configurable and can do this over a farm of real or virtual machines with different processor architectures, operating systems, compiler versions, etc. It can be configured to make the binaries it builds for different platforms available via its web interface. This is precisely what the developers of Chromium have done. Have a look here for yourself to see the Mac OS X builds. The file in this directory "LATEST" is a plaintext file with one line which is the latest revision number that the buildbot has tested, and there is a corresponding folder. Whenever the bot builds another rev, this file is updated, and a new directory full of the bleeding edge binaries is added.

So I whipped up this little script for myself. It pulls down the latest zip of the build, unzips out the Chromium.app, and moves it to your Applications folder. YMMV, but it works for me and here it is. (UPDATED 11 Nov 2010, thanks to thbarnes from the comments; the update makes it more generic by replacing my home directory name with "~", and updating the chromium buildbot URL to what the project is using these days. Also, make a folder on your desktop called chromium_nightly for this to work)

#!/bin/bash

BASEDIR=http://build.chromium.org/f/chromium/snapshots/Mac
cd ~/Desktop/chromium_nightly

echo "Downloading number of latest revision"
REVNUM=`curl -# $BASEDIR/LATEST`

echo "Found latest revision number $REVNUM, starting download"

curl $BASEDIR/$REVNUM/chrome-mac.zip > $REVNUM.zip

echo "Unzipping..."
unzip $REVNUM.zip 2>&1 > /dev/null
echo "Done."

echo "Moving to Applications directory..."
rm -rf /Applications/Chromium.app/
mv chrome-mac/Chromium.app/ /Applications/
echo "Done, update successful"
I hope you like using Chromium as much as I do.