Getting TortoiseHG working on OSX

These are the steps I took to get TortoiseHg working on OSX (Snow Leopard), using pygtk and the hgtk script included with the TortoiseHg installation.

  1. Download TortoiseHg. The Windows exe or msi files won’t work, so you’ll need to follow the links to download from source, or go straight here and get the latest version. Extract it somewhere memorable (I went with /tortoisehg/) and take note of the path to the hgtk script (for me it was /tortoisehg/hgtk)
  2. Make sure X11 and XCode are installed. If you’ve got a developer setup they probably are already, otherwise you can install X11 from the Snow Leopard disk and download XCode from Apple. X11 and the tools included with XCode are used to display the TortoiseHg GUIs. If you have XCode and the in Applications you’re good to go.
  3. Download and install MacPorts. The Snow Leopard package is what I used. MacPorts will let us install pygtk, which is needed to run the TortoiseHg GUIs from Python. It also turns out to be really helpful for installing everything else.
  4. Install pygtk. You’ll need to open up a Terminal window and use MacPorts for this:
    sudo port install py26-gtk
    There’ll be a bunch of dependencies that will download and build, this took a few hours on my Mac Mini, and a whole day on my virtual mac.
  5. At this point, I had issues with Python. This may not be the case for you, but when I typed “python” at the command line it was launching the Apple version of python that couldn’t import pygtk, instead of the MacTools version. Try loading up Python and typing ‘import pygtk’ then pressing ENTER to see if it works. If there’s an error message you may need to change your Python version – I used python_select to do this, which I installed using MacPorts:
    sudo port install python_select
    and then
    python_select –l
    to see what versions you have. Pick the one that’s not Apple with e.g.
    sudo python_select python26
    (note the sudo: you may not have permissions if you try the command without it)
  6. Install mercurial. I’m putting this as step 6 because if you do it before you’ve selected the Python version you can end up installing it to the wrong Python. Just grab the OSX 10.6 version and install it from the website, or I’ve found using MacPorts works just fine too
    sudo port install mercurial
  7. Install iniparse. This is needed to get the settings working properly for tortoisehg. You can use the website link, or MacPorts again
    sudo port install py26-iniparse
  8. /path/to/hgtk should work now, but it will only display a list of options and then quit out. Create a symlink of hgtk in one of your PATH directories (I went with /usr/bin/ but use “env $PATH” at the command line to find one that works for you)
    sudo ln –s /path/to/hgtk /usr/bin/
  9. Find yourself a Mercurial repository, navigate to it in the Terminal and type hgtk commit. If you get some warnings about RANDR just ignore them, it’ll still work. TADA!!! There’s our favourite commit window!

Okay, now just make sure your username is properly set up in both the global and repository settings, and you’re good to go.

Now get back to work Smile

Recovering from boot nastiness

I recently went through the process of installing MacOSX on my Dell Studio laptop, eventually (with much swearing) getting a Dual-Boot system with Vista and OSX running.  Along the way I ran into some problems and their respective solutions, which I’ll list here:

Problem: Starting up from the OSX CD was freezing or only booting sometimes, and when it did work I couldn’t see my hard drive to install on.

Solution: The version of OSX install I was using (iDeneb 1.5) had an issue with AHCI SATA – setting the SATA mode in the BIOS to ATA (or IDE or whatever isn’t AHCI) fixed this quite nicely, and from what I read it should be possible to switch it back after installation (which is good because Vista wouldn’t work without the AHCI setting).

Problem: Once OSX was installed, the computer hung on a blinking underscore and wouldn’t boot anything.

Solution: The blinking underscore happens because the system can’t find a valid bootloader.  The OSX install over-rode Vista’s bootloader, but then didn’t actually install its own.  My solution was to stop trying to use iDeneb and switch to a different OSX86 release.  Booting into Vista and replacing the boot file on the Mac drive with a Chameleon or EFI release probably would have worked too.

Problem: I’ve given up on iDeneb and want to go back to Vista, but there’s no bootloader

Solution:  Getting the Vista bootloader back requires the Recovery Console (from a Vista Install disc go to Repair My Installation and skip all the Wizard crap).  Then in the recovery console type:

bootrec /fixmbr

To fix the master boot record, then

bootrec /fixboot

To fix the boot partition.  In my case, the /fixboot command returned an error, which turned out to be because the OSX install had also made my other partition the active one.  So in the recovery console type


Then use the following commands to find your Vista partition and make it active again

list disk
select disk 0

(in my case it was 0)

list partition
select partition 2

(again, in my case)

detail partition 

(this showed the partition was marked as Active:no)


After these steps the bootrec /fixboot worked successfully and the system booted into Vista without problems.

Problem: OSX installs and boots (finally!), but only into a White Screen of Death with the cursor smeared across the screen like a hot girl in a Saw movie

Solution: ATI drivers are baadfood when it comes to the Mobility HD 4570 in my particular model of Dell Studio 15.  Deleting the ATI driver Kernel Extensions (kexts) from System/Library/Extensions on the max drive forced software rendering, which I’m happy with at the moment.

Most of these instructions should also apply for Windows 7 systems.  I recommend downloading and installing EasyBCD to run a dual-boot system using the Vista bootloader.  It’ll also give you a much easier way to restore the Vista bootloader if you’re luckier than I was and OSX installs successfully.