1. Yuki Kodama
  2. thg-ja


Clone wiki

thg-ja / MacOSX

TortoiseHg Mac OS X port

It is our intention to have a viable TortoiseHg port for Mac OS X in time for the July release of THG 0.8. Google has generously donated a Macbook directly for this cause. This page will track the progress of this project.

I've successfully run the TortoiseHg dialogs on Mac OS X on a native GTK+ port (no X11) by building GTK+ and PyGtk.

GTK bugs:

  • windows receive too many map events. For some, like hgcmd, this was dangerous (fixed in 0.8)
  • errors reported when first typing into text entry widgets: from gdk_cursor_ref and gdk_cursor_unref
  • treeview cursor is not always updated when clicking on a row, though row selection has obviously changed

This is an unreleased GTK+ version, so this isn't a surprise. However, it's more reason to lean towards a Qt port for TortoiseHg.

I'm getting deprecation warnings about gtk.Tooltips(). We can't move to gtk.Tooltip() until after 0.8, as this forces us to deprecate 2.10, which was used just recently in 0.7. If these warnings annoy you, you can disable them by adding to hgtk:

import warnings

I'm using FileMerge.app as my merge and visual diff tool. I had to download fmdiff wrapper script for it (see the Mercurial Wiki), and it does behave a little strangely compared to Linux and Windows diff tools. You must exit the application entirely before it releases the process, so code that blocks waiting for the diff process to exit could wait a long time if you don't remember to command-Q your diff instances.

Installer progress

I tried py2app, which seems to be the natural candidate for building an installer for a python application. I created this setup-mac.py file based on the py2app instructions:

from setuptools import setup
import os
APP = ['hgtk.py']
OPTIONS = {'argv_emulation': True}
data_files = [(os.path.join('share/pixmaps/tortoisehg', root),
        [os.path.join(root, file_) for file_ in files])
        for root, dirs, files in os.walk('icons')]
    packages = packages,
    options={'py2app': OPTIONS},

py2app expect the main application to have a .py extension, so you need to copy hgtk to hgtk.py You then run: python setup-mac.py py2app

And this generates a bunch of spew and then actually creates an hgtk.app file that looks like it has everything you need. But, when you try to launch the application it dies immediately because it cannot find _glib.so even though that library is clearly inside the package.

Google found this mailing list post (with no responses): http://www.daa.com.au/pipermail/pygtk/2009-January/016492.html


  • Report GTK bugs, pray they get fixed
  • Shell integration. Currently just a vague plan. There is an effort already underway to generalize the context menu and overlay cache code used by windows so it can be shared with Nautilus and whatever extension we provide with Mac OS X. I have culled the following two links from the mailing list:


If you would like to help in any of this effort, just send an e-mail to the developers list.