Fork me on GitHub

article

Automatically download Chromium nightly builds

May 29, 2010 | Web Design & Development | 5 Comments

Updated July 7, 2012: Fixed an issue on Lion where moving old version of Chromium to the trash would fail. Also now opens Chromium after the update is complete.

Updated June 9, 2011: The nightlies moved again. The script below has been updated for that change.

Updated Oct. 28, 2010: Sometime recently the Chromium nightlies moved. The script below is a revised version to reflect that change.

So, if you’re one of the geeks that likes to live on the cutting edge of cool and use the Chromium nightly builds instead of Google Chrome proper or one of those paranoid types that wants to stay away from the built in usage tracker in Google Chrome then this post is for you. Well, the Mac users out there at least ;)

I’m not the first to do this and I probably won’t be the last, but here is a script that I polished up that downloads the current nightly build of Chromium and drops it in to your Applications folder. Run it manually or hook it up to your favorite cron like system and have it do the work automatically.

The Script

  1.  #!/bin/bash
  2.  # Script for auto-updating chrome nightly builds
  3.  # Once in a while this will need updating. They like to move the source periodically.
  4.  # See: http://top-frog.com/2010/05/29/automatically-download-chromium-nightly-builds/ for info
  5.  
  6.  LATEST=`curl -s http://commondatastorage.googleapis.com/chromium-browser-continuous/Mac/LAST_CHANGE`
  7.  CHROMEURL="http://commondatastorage.googleapis.com/chromium-browser-continuous/Mac/$LATEST/chrome-mac.zip"
  8.  echo "Fetching $CHROMEURL"
  9.  /usr/bin/curl -L "$CHROMEURL" -o /tmp/chrome-mac.zip
  10.  wait
  11.  
  12.  echo "Unzipping"
  13.  /usr/bin/unzip -o -qq /tmp/chrome-mac.zip -d /tmp
  14.  wait
  15.  
  16.  echo "Stopping existing Chromium (if necessary) and moving old file to trash"
  17.  /usr/bin/osascript -e "
  18.  tell application \"System Events\"
  19.   if exists (some process whose name contains \"Chromium\") then
  20.   tell application \"Chromium\" to quit
  21.   end if
  22.  end tell
  23.  tell application \"Finder\"
  24.   if exists (file \"Chromium.app\" in folder \"Applications\" of startup disk)
  25.   move file \"Chromium.app\" in folder \"Applications\" of startup disk to trash
  26.   end if
  27.  end tell"
  28.  
  29.  echo "Moving new Chromium in to place"
  30.  /bin/cp -Rf /tmp/chrome-mac/Chromium.app /Applications
  31.  wait
  32.  
  33.  echo "Cleaning up"
  34.  /bin/rm -rf /tmp/chrome-*
  35.  
  36.  echo "Done"
  37.  open /Applications/Chromium.app
  38.  exit 0

Save the script to an executable folder (I keep a ~/bin folder in my home folder that I’ve added to my path), do a chmod +x filename on the file to make it executable and have at it. Adding it to cron or creating a launchd plist and you’ll be up to date automatically (pending that your computer didn’t sleep through the designated update time…).

The Caveat

If you have an Adobe Creative Suite 4 or earlier installed you have a 32bit version of the “Adobe Unit Types.osax” file in your scripting additions folder. This will cause the script to spew chunks at the Applescript portion. The script still operates but it doesn’t automatically quit Chromium during the update process. You have two options to fix this:

  • Download a newer version of that library from Adobe’s Support Site
  • If you don’t script your Adobe apps at all you can safely zip up the “Adobe Unit Types.osax” file and the script will work.