Is there a binary out there for the current mac os x, python for PyGTK? I work with multiple desktop environments (mac, windows, gnome) and really consider python's lack of cross platform GUI's a problem. Does anyone know where I can find a built version of PyGTK and GTK for Mac? I cant clone the git repository, it keeps timing out.
-
2http://macpkg.sourceforge.net/ – schlamar Jun 06 '12 at 21:00
6 Answers
brew install pygtk
worked for me (requires homebrew).
Confirmed to work with OS X 10.10 too, but by default it will install it into brew's Python distribution, so if you are still using the native python, it will not find it.

- 21,988
- 13
- 81
- 109

- 20,399
- 5
- 40
- 46
-
1This failed for me : Error: Is a directory - /usr/local/opt/fontconfig/INSTALL_RECEIPT.json any ideas why I got that? – zabumba Oct 11 '13 at 11:12
-
No idea. You should probably ask those responsible for the brew package of pygtk, brew itself, or pygtk itself, depending on if you can find out where the message came from. – chelmertz Oct 11 '13 at 11:15
-
It`s work for me on Mac OS X 10.10.4. By the way, I just talk it to run the sm.py. – Chu-Siang Lai Jul 14 '15 at 07:48
-
1Warning: No available formula with the name "pygtk". Did you mean pygitup? – Keith Tyler Dec 22 '21 at 19:08
I don't use macports but it seems that jhbuild works for me. Below is the steps that I've done.
- download gtk-osx-build-setup.sh from:
https://raw.github.com/jralls/gtk-osx-build/master/gtk-osx-build-setup.sh
and save it to your home directory. - fire up terminal and navigate to your home directory and run the command
sh gtk-osx-build-setup.sh
- the shell script will warn you that
~/.local/bin
isn't added to your environment variable to do this, edit your.profile
file located at your home directory and/Users/<username>/.local/bin
to your environment variable. to know more on how to edit this file check out:http://www.tech-recipes.com/rx/2621/os_x_change_path_environment_variable/
- after that, do a
~/.local/bin/jhbuild bootstrap
command. it will download and install some necessary utilities. - download and install the beta version of the gtk+ osx framework at:
http://ftp.imendio.com/pub/imendio/gtk-osx/Gtk-Framework-2.14-LATEST.dmg
- before installing the
meta-gtk-osx-python
, you need to build and install some other packages thatjhbuild
doesn't install automatically, so what i did was i installedlibpng
by doing the command:~/.local/bin/jhbuild build libpng
- you also need to install
libtiff
so do the command:~/.local/bin/jhbuild build libtiff
- and also
gtk-doc
is needed so:~/.local/bin/jhbuild build gtk-doc
- and finally you can now install
meta-gtk-osx-python
by doing a:~/.local/bin/jhbuild build meta-gtk-osx-python
Let me know if it works.

- 30,900
- 8
- 101
- 128

- 366
- 1
- 2
- 8
-
tried this too, looks like work is blocking git also... git.gnome.org[0: 209.132.176.202]: errno=Operation timed out fatal: unable to connect a socket (Operation timed out) – Ronaldo Nascimento Jul 23 '09 at 11:09
-
If what your doing is work related. Might as well, ask your IT department to unblock git. – b3rx Jul 23 '09 at 11:41
-
Resolving ftp.imendio.com... 88.131.94.22 Connecting to ftp.imendio.com|88.131.94.22|:80... blink .. blink .. – Skylar Saveland Apr 28 '11 at 18:02
-
3the gtk-framework-2.14-latest link does not work, you can google for it, I found this link on the internet: http://sourceforge.net/projects/mokoi/files/Third%20Party/Gtk-Framework-2.14-LATEST.dmg/download?use_mirror=surfnet – Varun Mehta Aug 17 '11 at 18:42
-
I get No module named libxml2 error on gtk-doc installation - Any idea? – billwild Feb 25 '13 at 19:45
-
Detailed instructions and everything you need are available here: https://wiki.gnome.org/Projects/GTK+/OSX/Building – davidcondrey Jun 06 '15 at 04:29
There is an installer for PyGTK 2.24 in test here, announced on the PyGTK list.
UPDATE project has moved on macpkg's sourceforge page.
I couldn't make it work with meld (segmentation fault), but sample PyGTK programs work OK.
UPDATE 2 since then a new package Py3GTK3 appeared on the same sourceforge page. Haven't tested though.

- 86,532
- 28
- 194
- 218
-
I tried Py3GTK3, but in python command line, when i do: `from gi.repository import Gtk` I got errors. Did somebody succeed with it? – Jacob Jedryszek Mar 26 '14 at 16:52
There is now a mac package on sourceforge

- 11,355
- 3
- 53
- 66
-
Can't upvote this enough. Any one looking through the answers notice this was 3 years after the accepted answer and is now the correct answer in my opinion – Anake Aug 29 '13 at 15:19
-
1I managed to install, but it's still not found. Where does is install the package? – zabumba Oct 11 '13 at 11:56
-
Download the latest package from http://sourceforge.net/projects/macpkg/files/PyGTK/ and install.
If you're just trying to use the system python, this is all you'll have to do.
If you're not, the following is how to install it with pyenv, which can be installed with Homebrew. With brew installed, you can install version pyenv and Python 2.7.8 with:
brew install pyenv && pyenv install 2.7.8
After you've done that, you'll then have copy the gtk package and its dependencies into your python installation:
cd /opt/gtk/lib/python2.7/site-packages/ && \
cp * ~/.pyenv/versions/2.7.8/lib/python2.7/site-packages/
That's it. You can also similarly install the Py3GTK3 package which has packages for python 2.7 and 3.2 from http://sourceforge.net/projects/macpkg/files/Py3GTK3/.

- 3,817
- 1
- 30
- 48
-
A better way `export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH` – Bruno Wego Apr 16 '16 at 14:34
Have you tried doing it using macports? This website shows how.

- 5,305
- 4
- 33
- 39
-
Yeah, tried that before, I think rsync is a protocol blocked by our org's firewall. sudo port -d selfupdate rsync: failed to connect to rsync.macports.org: Operation timed out rsync error: error in socket IO (code 10) at /SourceCache/rsync/rsync-35.2/rsync/clientserver.c(105) [receiver=2.6.9] Error: Synchronization of the local ports tree failed doing rsync Couldn't sync the ports tree: Synchronization of 1 source(s) failed – Ronaldo Nascimento Jul 22 '09 at 13:25
-
They didnt teach anything in school, just C and ASM back in my day. Sorry to have offended you. – Ronaldo Nascimento Jul 22 '09 at 16:57
-
Sorry, i think i didnt read that right. anyway I am looking at /opt/local/etc/macports/macports.conf and i see the rsync_options, and I added -e "ssh" but no luck I must be doing something wrong. – Ronaldo Nascimento Jul 22 '09 at 17:12
-
They still don't, I was using SSH to get to all the blocked websites, like youtube, or to steam music from home. :) What are you messing with the rsync config for? Just use ssh and tneel the port. http://manas.tungare.name/blog/ssh-port-forwarding-on-mac-os-x/ – Sneakyness Jul 22 '09 at 17:19
-
what would the command line look like? Do i need a middle server? this has become an all day affair. – Ronaldo Nascimento Jul 22 '09 at 17:26
-
@RonaldoNascimento instead of 'rsync' macports can use http also. IIRC, you need to modify /opt/local/etc/macports/sources.conf file. – shantanoo Oct 19 '15 at 13:39