Creating a bootable USB stick from OSX

I was having some trouble getting my ML110 Proliant lab server to boot from a USB drive that I had created with UnetBootin on my Mac. Initially, I thought it was a problem with the ML110 server, but it turns out that Unetbootin does not currently make a fully bootable USB stick in OSX. The trick is that you have to set up the master boot record correctly yourself using DiskUtil, fdisk and an MBR file from the SysLinux project. In this tutorial I will show you how.

If you would like to create a bootable USB drive from OSX, you will need:

Step 1 – Format the disk in Disk Utility, with the correct MBR

Assuming you have already inserted your USB drive into your Mac…

a) Open Disk Utilty

b) Select the USB device

c) Click Partition

d) Select 1 partition in the partition layout

e) Select “Master Boot Record” in the options

f) Select MS-DOS (FAT) in the format type.

g) Click Apply, then Partition

h) Close Disk Utility

This will wipe the USB disk and set it up with the correct boot record.

Step 2  – Install the MBR binary from the SysLinux project

Open up a terminal and then

a) Use the command line diskutil to find the device name for your USB drive.

diskutil list

a) Umount the USB drive with the command line. NB: Be sure to swap the device reference (in my case it is /dev/SOMEdisk2) with the correct one for your usb key that you identified in the previous step – this will change for each machine.

diskutil unmountDisk /dev/SOMEdisk2

b) Mark the partition active, then unmount it again

sudo fdisk -e /dev/SOMEdisk2
f 1
diskutil unmountDisk /dev/SOMEdisk2

c) Download Syslinux

mkdir -p ~/Documents/BootableUSB
cd ~/Documents/BootableUSB
curl -L -O
unzip -d syslinux-5.00
cd syslinux-5.00/mbr

d) Install the MBR – NB: Update the device name (/dev/SOMEdisk2) to the one you identified in the first step!!!

sudo dd conv=notrunc bs=440 count=1 if=mbr.bin of=/dev/SOMEdisk2

Step 3 – Use UnetBootin to install your OS install files

a) Download and install UnetBootin if you haven’t already from

b) Load the application, choose your preferred distribution, and then click OK.

c) When it’s finished, eject the usb key and use it!


Thanks to a tip I found on

Installing Ansible on OSX Lion

We’re currently evaluating configuration management (devops) tools at CATN to help us deploy and manage our new vCluster hosting platform in a production environment. Many of the tools we have looked at are fairly complicated, with a steep learning curve.

Then we came across, Ansible. It’s developed primarily by the guy who wrote Cobbler (our previous favourite deployment tool), and it’s been built from scratch to be much simpler to use.

Although it only took me just a few minutes to get it up and running, there were a couple of dependencies required to install it on OSX, so I thought I would document the steps here in case it helps someone else in the future:

Step 1 – Install Dependencies

Check that you have Xcode installed with , try typing gcc -v from the command line. If it says command not found, then ensure you have downloaded Xcode from App Store, then once it’s installed go to Xcode > Preferences > Downloads  and install the Command Line Tools.

Install pre-requisite Python modules on your main OSX machine that will be running ansible.

sudo easy_install jinja2
sudo easy_install PyYAML
sudo easy_install paramiko

If you get an error saying configure: error: no acceptable C compiler found in $PATH then you should double check you have Xcode and it’s command line tools as per the instructions above.

And on the managed nodes, assuming it’s a Centos/SL/RedHat node:

yum install python-simplejson

Step 2 – Checkout latest version of Ansible

Download the latest version from Github. Assuming you are installing into ~/github

cd ~/github
git clone git://
cd ./ansible
source ./hacking/env-setup

Set up your bash profile to load the environment variables when you load a terminal

# Setup Ansible
cd ~/github/ansible
source ./hacking/env-setup
cd ~
export ANSIBLE_HOSTS=~/ansible_hosts
# End Ansible Setup

If you wanted to install it properly, rather than run the latest code from checkout you could do so with sudo make install. In this case you wouldn’t need to run the hacking/env-setup script to modify the environment variables, since ansible would be located within the ordinary search paths.

Step 3 – Test it works

Add some hosts to your ansible_hosts file, and then ping them.

echo "" >> ~/ansible_hosts
ansible all -m ping

How to set up iChat for Facebook

Tonight it was announced that Facebook chat now supports XMPP (also known as Jabber). This means that it will work with a host of chat clients, including my personal favourite iChat.

To get it working with iChat you simply follow these steps:

  1. Navigate to iChat > Preferences > Accounts
  2. Click the plus icon in the bottom left hand corner, to add a new account
  3. Select Jabber as the Account Type
  4. Enter [email protected] in the Account Name (where username is your facebook username).
  5. Enter your facebook password in the password box.

And that’s it!

Facebook has some instructions on how to set up other popular clients here.

Shared Calendars on the Mac & iPhone with Google Sync

Today I have been attempting to set up Google Calendar so that it automatically synchronises with an iPhone and also iCal on a Mac computers. It was a bit trickier than I expected, so here are some of my observations. Hopefully they will help someone else!

Google Sync 

Here are some of the main things you need to remember to do:

  1. Make sure you have enabled Google sync for mobiles in your Google Apps account. From your Google Apps Dashboard, click the Mobile link. Then tick the Enable Google Sync box on the next page and press save.
  2. Set up Google Sync on your iPhone to sync calendars and contacts from Google. Basically you just add a Microsoft Exchange account with your google apps login details, and then select calendars and contacts in the syncing options.
  3. You must also choose which calendars you want to sync to your iPhone via the Google Mobile website. Visit in Safari on your iPhone.


You can set up iCal to subscribe to your Google Calendars via a caldav url. First you add a new account under preferences, and then under the delegation tab you select the calendars you wish to subscribe to.

Sharing Google Calendars 

You can share a calendar with other users in your google apps domain, or external users on other domains. There are various ways to do this such as sending a link to the ical url or sending an invite within the calendar sharing pages on the Google Calendar website.

How to upgrade iphone 3.0 beta to full official release

If you are an iPhone developer and have been running one of the beta versions of the 3.0 firmware then you might find that iTunes will not update you to the latest official 3.0 release, as it already thinks you are using the most recent version.

It’s taken me a while, but I’ve finally found out how to do it!

NB: Before you do anything, make sure you have backed up your phone in case something goes wrong!

  1. Download the latest firmware directly from Apple’s Content Delivery Network:
  2. The file may have a .zip extension, if so remove this by renaming the file so that it ends with .ipsw
  3. Open up iTunes, and Option-Click the restore button. You should then select the ipsw file you downloaded.
  4. Follow the on-screen instructions as it upgrades your firmware.

Warning – do this at your own risk. It may break your phone.

Developing with Subversion, Unfuddle and OSX

Today I’m going to be helping one of our investment companies, ByteWire set themselves up with a subversion based development environment for their Street Crime game. They will use a straight forward workflow whereby they will develop and test their code locally on their iMacs, commit working code to a subversion repository, and then check out code the live site when they are happy with it.


We’re going to be using Unfuddle to provide subversion hosting, project management and bug tracking.

  • Create a free unfuddle account, e.g. Bytewire
  • Set up your first project e.g. Street Crime
  • Create a repository:


Set-up a local test domain on OS X

  • Add it to the hosts file
printf "\tstreetcrime\n" | sudo tee -a /etc/hosts
  • This should now be accessible via http://streetcrime/


MAMP is an excellent bundle of Apache, MySQL and PHP for use on Macs. These tools do come pre-installed with Leopard by default, but php in particular is missing a fair few modules which you can only really add by re-compiling – MAMP makes it a lot easier. It installs new versions of PHP, MySQL and Apache alongside the default versions (on different ports), so that both can be run at the same time.

    • Create a folder where the site code will be placed, e.g. /Applications/MAMP/htdocs/streetcrime/http/
    • Open up /Applications/MAMP/conf/apache/httpd.conf with a text editor.
    • Uncomment the NameVirtualHost line, and add a couple of news lines to define the new virtual host. It should look like:
NameVirtualHost *

<VirtualHost *>
DocumentRoot /Applications/MAMP/htdocs/
ServerName localhost

<VirtualHost *>
DocumentRoot /Applications/MAMP/htdocs/streetcrime/http/
ServerName streetcrime
  • Restart MAMP through the MAMP control applet or widget. You should then be able to access the site at http://streetcrime:8888/


  • Make the trunk folder inside the repository where your site code will initially be kept.
svn -m '' mkdir
  • Check out the trunk to your project top level folder
svn co /sites/
  • Check through the folder structure and look for anything that should be excluded:
du -h --max-depth=1 /sites/
  • Edit the svn:ignore property
svn add /sites/
svn propedit svn:ignore /sites/
  • List the files & folders that you want to ignore, and then save and quit.
  • Add the remaining files and commit (excluding uploads etc with svn:ignore)
svn add --force /sites/
svn commit -m 'Importing main files'


  • Change directory to the folder you set up locally for development.
cd /Applications/MAMP/htdocs/streetcrime/
rmdir http
svn co .


  • Visit http://streetcrime:8888/ – it showed a blank page for me. That would suggest error reporting is off, so enable in /Applications/MAMP/conf/php5/php.ini

iPhone 3.0 Software Update

Apple held a media event today to announce the new iPhone OS 3.0 firmware update. The new software adds many new features to the iPhone including:

  • Copy and Paste – at last! Speaks for itself.
  • Bluetooth Stereo (presumably A2DP) – allowing you to stream high quality audio between devices. This will be great for in car audio systems, no dongles required!
  • Bluetooth P2P – uses bonjour to automatically discover nearby phones, allowing peer-to-peer applications and (hopefully) file transfers.
  • Spotlight Search – search across mail, calendar and other 3rd party applications.
  • Tethering – allows the phone to be used as a modem for your laptop other computers.
  • Messages App – can now forward and delete individual messages. Supports MMS, and can send and receive files and contact cards.
  • Push Notifications – allows the phone to receive notifications over the air from a 3rd party’s server – e.g. useful for instant messaging.
  • Voice Memos – record audio notes.
  • Landscape Keyboard – rotated keyboard now works with most built-in apps.
  • Turn by Turn Directions – spoken directions available as part of the core location API.
  • 3rd Party Accessories – better support for interfacing with 3rd party accessories via bluetooth and the dock connector. The iPhone could be used to control other hardware.
  • In-App Purchases – extra content maybe purchased from within an app, e.g. e-books for a reader app (kindle), or extra levels for a game.


That’s pretty much everything I could have wanted in the new firmware – and more! The only extra thing I will be looking for in the next hardware version is video calling.

The Ultimate OS X Text Editor – Coda

Just yesterday I was recommended a new text editor for the Mac. It’s called Coda and I’m loving it! Here’s why:

  • The layout is really nice, it makes good use of your whole screen with a single editor window.
  • It has an innovative “sites” feature that takes a screen shot of all your project’s home pages, which serves as a nice way to browse them.
  • It has built in SFTP support – if I’m honest, I was getting a bit fed up of TextMate + MacFusion to access all our sites.
  • It has a built in terminal, so you can instantly SSH to your servers as the same user as you use for SFTP.
  • It supports subversion, you can commit and update from the file browser side bar.
  • It has a collaboration mode, so you can simultaneously edit the same script as a co-worker.


Coda Keyboard Shortcuts

  • CMD + 2 – Switch to edit mode for the currently selected file.
  • CMD + 3 – Switch to preview mode for the currently selected file.

Changing the default Umask on OSX Leopard

We use Macfuse to connect to our office development services. It lets us mount remote folders via SSFHS. The problem is that when we create a file via this connection, the default permissions are missing the group write bit, and so other users who connect to this system can’t write to them.

There is a fix available for OS X 10.5.3 and above –

One of our developers at Fubra has released a small package that automatically fixes the umask settings this for you. You can download it here

Or if you want to do it yourself via the command line, I’ve written some brief instructions. Basically, it involves 2 steps.

  1. Open up the Terminal application, and then create a file called /etc/launchd-user.conf 
  2. Add a line to the file containing the umask setting you want, in our case this was umask 002 


sudo vim /etc/launchd-user.conf
umask 002

NB: This sets the umask for every user on the system. So be careful what you choose!