Making gitk look good on Mac OS X

Does your version of gitk look like Windows 95's ugly step sister? Would you rather it used native buttons and widgets, and a half decent font?

I managed to get mine looking slightly less rough:

GitK running on a Mac with native widgets

Here's how you set it up...

Step 1: Running gitk with native Mac buttons

You need to launch gitk with the version of Tk that came with your Mac. A different version of Tk (that you might have installed with MacPorts or homebrew?) is probably what's making it look ugly.

Try this:

$ /usr/bin/wish $(which gitk)

If it works, avoid re-typing that the next time you login by adding an alias to your ~/.bashrc file:

alias gitk="/usr/bin/wish $(which gitk)"

From the next time you log in gitk won't look (quite so) crap when you start it from the command line.

Step 2: Changing the gitk font

If you've seen the PeepCode git screencast you'll be aware of this one already (all credit goes to Geoffrey). The first time you run gitk it creates a .gitk file in your home directory. Open it in your editor and change the first three lines to something like this:

set mainfont {Inconsolata 14}
set textfont {Inconsolata 14}
set uifont {"Inconsolata Bold" 12}

If you've not got the Inconsolata font installed, Monaco makes a good substitute.

Restart gitk, et voila!

Alternatives to gitk

I wrote this post well over a year ago, but for some reason forgot to post it. I hope it'll be useful to somebody. Since then git viewers on the Mac have moved on considerably.

You could also take a look at:

  • GitX: A native Cocoa app, it's fast and has a great user interface. In combination with the command line I can do everything I need. It's well worth checking out brotherbard's version of GitX which has some cracking extra features.
  • gitnub: A Ruby app with a Cocoa user interface. Looks nice, but less powerful than GitX.

I love feedback and questions — please feel free to get in touch on Mastodon or Twitter, or leave a comment.