Compiling PyQt4 on Mac OS X 10.6 (Snow Leopard)

17 06 2011

So i recently started messing around with pyqt4 and python, and i wanted it to work on my mac, but to my dismay i had to compile it from source.

So, here is how i did it. You will need some things

You will probably need XCode so you get access to gcc and other things. You can get it from here: (you either need to pay 5 dollars for xcode 4 or look for a link on that page saying “looking for xcode 3?” which is free.)

First, download and install the QT SDK here: I would put it somewhere in your home folder, I put it in ~/Programs/QtSDK

Now, you need to download the source tarballs (the Mac OSX / Linux ones) for PyQT4 and SIP (which is used to generate the python bindings for the c++ code in qt). Get them here: and . I created a folder pyqtstuff to put the source tarballs in. Extract them both and you should have two folders for each of the tarballs.

You need to compile SIP first. Now Mac OSX has python 2.6 already installed, if you want to use python 3 you need to install that. Whatever version of python you want to use pyqt4 with, you NEED to run the following scripts with the version of python you want to use. So if you want to use 2.6, you just use ‘python’, if python 3, then ‘python3 .

So, change directories to the sp folder and then run these commands.



sudo make install

If all goes well, then it wont report any errors.

Now you change directories to the pyqt folder, and do the same thing, making sure to run the script as the version of python you are going to use with pyqt. BUT , i had a problem where it was saying that ‘qmake’ was not in my path. Never fear, thats why you downloaded the QT SDK. You need to locate the folder where you installed it, and deep inside it is the qmake binary. I installed the sdk to the QtSDK folder, and my qmake was in :


The version number will probably differ, but other then that the path is the same. Now, make sure you copy the FULL PATH (from root, so for me it would be  /Users/<username>/Programs/QtSDK/Desktop/Qt/473/gcc/bin/qmake , but substitute this with your own) and you need to pass it as an argument to the call. Again run this with the version of python you intend to use!

python -g -q <PATH TO QMAKE HERE>

That will configure pyqt. We use the -g because that ‘consolidates’ everything, which i’m not sure what that means, but the other option it told me to use did not work.

Now you just compile it and install it. This will probably take a bit of time since its kinda big. Be patient


sudo make install

Done! now you should be able to use PyQt4 on your mac. Hopefully this helps someone since I did not find a guide for it online yet. Post here if you have any questions!




9 responses

24 08 2011

Thank you SO MUCH! It’s amazing what you can find online.
I just installed Qt, and SIP and this is the help I needed.

17 09 2011

great stuff, works! very helpful, thanks

30 10 2011


8 11 2011

I spent two hours on this and then found your post and in 10 minutes resolved all, thanks!!!!

30 01 2012

Just a note that if you cannot use sudo, and you want to force 64-bit:

mkdir -p ~/bin ~/lib ~/share ~/include ~/Library/Python/2.6/site-packages

python –arch=x86_64 -b ~/bin -d ~/Library/Python/2.6/site-packages -e ~/include -v ~/share
make install
python –use-arch=x86_64 -g -q /Desktop/Qt//gcc/bin/qmake -b ~/bin -d ~/Library/Python/2.6/site-packages -e ~/include -v ~/share -e QtGui
make install
in your .profile / .bashrc etc:
export PYTHONPATH=$HOME/Library/Python/2.6/site-packages

I found I had to specify the module QtGui or it didn’t build, despite the docs saying that all modules are checked/built.

30 01 2012

(I had put sip-dir , pyqt-dir, qtsdk-dir, and qtsdk-version in less-than greater-than brackets which is why the cd’s show no directory, and why the path to the qtsdk qmake command is missing parts of the path. sorry! hopefully it is still decipherable)

2 05 2013
a four seater rhino

Its just like you read my head! You appear to know so much
applying this, because you wrote magic of creating up involved
or something which is. In my opinion that
you can employ some pics to drive your message home a bit, but as an alternative to that, it’s wonderful blog website.

19 04 2015
antalya escort

Having read this I thought it was extremely enlightening.
I appreciate you finding the time and energy to put this information together.

I once again find myself spending a significant
amount of time both reading and commenting. But so what, it was still worth

14 03 2017
judge gorsuch wife

Heya terrific blog! Does running a blog similar to this require a
lot of work? I’ve absolutely no knowledge of coding but I had been hoping to start my own blog in the near future.
Anyway, should you have any suggestions or tips
for new blog owners please share. I know this is off subject however I simply needed to ask.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: