Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I installed meld in Mac OSX with Homebrew:

brew install meld

Then, when I run meld . it fails with the following error:

Cannot import: pygtk

No module named pygtk

However, pygtk is already installed:

brew install pygtk

Error: pygtk-2.24.0 already installed

share|improve this question

3 Answers 3

The solution was to install PyGTK, directly from the pkg file in the repository:

http://sourceforge.net/projects/zero-install/files/PyGTK/2.24.0/org.pygtk.macosx.pkg/download

It worked flawlessly after that.

share|improve this answer
    
Wow it surely works after that. I first tried installing it through macports but that took so much time and in the end it didn't even work or maybe i couldn't figure out how to run it from terminal. But this options was simple. Thanks! –  Rahul Dole Aug 2 '13 at 15:43

I found that pygtk is only part of the package. For meld to work you need to install the following:

XQuartz

brew uninstall cairo gtk+ pygobject py2cairo pygtk
brew tap phinze/homebrew-cask
brew install cairo gtk+
brew install py2cairo pygtk
brew install pygobject
brew install meld

Afterwards if you ls "/usr/local/lib/python2.7/site-packages/" you should see this:

Mac-Pro:~ user$ ls -la /usr/local/lib/python2.7/site-packages/ | grep pygtk
lrwxr-xr-x    1 user  admin      84 Mar  3 19:46 gtksourceview2.so -> ../../../Cellar/pygtksourceview/2.10.0/lib/python2.7/site-packages/gtksourceview2.so
lrwxr-xr-x    1 user  admin      70 Mar  5 01:04 pygtk.pth -> ../../../Cellar/pygobject/2.28.6/lib/python2.7/site-packages/pygtk.pth
lrwxr-xr-x    1 user  admin      69 Mar  5 01:04 pygtk.py -> ../../../Cellar/pygobject/2.28.6/lib/python2.7/site-packages/pygtk.py
-r--r--r--    1 user  admin    2075 Mar  5 01:05 pygtk.pyc
lrwxr-xr-x    1 user  admin      70 Mar  5 01:04 pygtk.pyo -> ../../../Cellar/pygobject/2.28.6/lib/python2.7/site-packages/pygtk.pyo

pygobject is actually the library that creates the pygtk library links that meld is looking for, I think the install order is important, as all of these packages were installed and meld failed to start with a missing pygtk library error.

When installed in the above order meld functioned flawlessly on two separate machines running Mavericks 10.9.2 which previously had a full environment setup in which meld reported no pygtk library when started.

I found this worked without needing to set PYTHONPATH, not to say that it isn't a bad idea.

To execute meld, simply open a terminal and execute:

meld

Edit: Added tap cask, install cask, required for cairo to install. Added brew install meld, added execution instruction.

share|improve this answer

This seems to be the missing bit after installing using brew:

export PYTHONPATH=/usr/local/lib/python2.7/site-packages
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.