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

Renewed Desire

As I walked out of my last job and headed for the bus stop – my last day ended and a whole new life in another country ready to begin1 – I pulled my HTC Desire out of my pocket to check the time and it leapt out of my hands into a painful-sounding faceplant on the concrete, cracking the glass in front of the touchscreen. Devastated – and with glass splinters in my thumb from trying to check when the next bus was – I headed home.The broken phone.  And my broken dreams


A search on the Googles revealed that others in my situation had been quoted between $200 and $300 AUD to repair the touchscreen. Still others had chosen to ship parts from overseas repairers ($100 – $200 AUD) and replace the screen themselves. By the time I did my damage the phone was popular enough, and had been on the market long enough for me to be able to ship replacement parts from Hong-Kong for little more than $40 AUD. It turned out that the LCD was still working fine, but the broken glass cover at the front of the screen is actually the digitizer: The part of the screen that detects and sends the touches to the phone. 3 weeks later my replacement digitizer arrived and I set to work repairing my HTC Desire, following the instructions I found on this helpful website.


The screen came with several free tools for opening the phone (that didn't fit) A roll of double-sided tape and a $1 knife to attach the new screen

Tools needed:

  • – New digitizer
  • – Star screwdriver
  • – Cross screwdriver
  • – Separator
  • – Knife
  • – Double-sided tape

Step 1Step 1 is pretty easy – remove the cover, battery, SIM card and SDCard








Step 2 Step 2 is where I discovered that the cross-head screwdriver included with the replacement digitizer kit didn’t actually fit my phone, and had to go out and buy a new one. Note the VOID stickers that need to be removed to get at the screws: this procedure will end your warranty
Note the VOID stickers that need to be removed to get at the screws: this procedure will end your warranty



Step 3

Step 3 is where it starts to get hairy – try not to lose the Power button or Volume rocker as the circuit board comes out, and remember to unplug the antenna connection and to plug it back in when closing the phone up again.






Step 4

Step 4 gets a little scary- the screen is held into the frame pretty firmly, and it requires peeling and slight bending to get it out (not too much bending, mind you). There’s some metal tape stuff that has to be peeled off as well, but it’s pretty easy to stick it back on once you put the screen back in.





Step 5

Step 5 is similar to the last step, but worse. The digitizer is held in by a sticky black glue, and it’s necessary to pull it away far enough that you can cut it with the separator all around. I managed to do this without bending the frame, everyone else may not be so lucky.





There's a whole lot of gunk on the inside of the frame once the digitizer has been removed Easily cleaned off using the knife and some cheap alcohol (yes, Vodka works)

Step 6 just involves cleaning the frame so that the new screen can go in.






Step ??

Step 7: Put it all back together and…it doesn’t work. Crap.

Whenever I touch the screen it brings now the notification panel. I was lucky to get the phone unlocked for the picture.


Strangely, it seems to work fine when the screen is left just slightly out of the frame, so I went ahead with the next step. This eventually ended okay, as the tape made the screen work for some reason.

 Double-sided tape Cutting the roll into 2mm pieces

Step 8 is to glue the digitizer back into the frame using small (2mm) strips of double-sided tape placed along the edges.





Step 9 is to gloat!  I replaced my screen for less than $50!









Overall it was a surprisingly easy procedure, despite the worry about the screen not working about halfway through. If you can’t afford to get the screen replaced by an official repair centre, or don’t have warranty anymore, and you’re comfortable pulling the pieces out of a Tandy Robby Robot toy then by all means go ahead and replace the digitizer yourself!

Just don’t sue me if you stuff it up.

  1. I’ve since moved to Vancouver, Canada for a 2 year working holiday []