How to Install PyQt4 on OS X

Note : this is a tutorial on Mac OS X 10.6.4, with : PyQt-mac-gpl-snapshot-4.7.5-8a6793a155e0.tar.gz and with : sip-4.11-snapshot-052b642f04a8.tar.gz.It should be the same on previous and next versions. ( if you have some bugs you may also contact me )

How to install PyQt4 ?

Download the SIP package (snapshot for OS x )

Download the PyQt package (snapshot for OS x)

Download Qt

Install Qt

Install SIP

Install PyQt

and try !

Let’s download the Qt binary from the website : Download site (You may take the complete SDK)

In OS X Lion and with the new versions there is a thread on QT website https://bugreports.qt.nokia.com/browse/QTCREATORBUG-6222 which says that qmake-4.7 is hidden in /usr/bin. Could someone confirm that it works.

EDIT 2013 :

Many of you happen to have problems installing PyQT and ask me questions about the installation process and errors, via e-mails, or in the comment section, please note that I can’t answer all of them, although, if you find a fix to your problem, please let me know, or add a comment with the fix ! You are probably not the only one with the problem.

Randall Munroe : xkcd: Wisdom of the Ancients

Edit 09/13 :

If you previously encountered the following issue :

1

“Error:Failed todetermine the layout of your Qt installation”.

It might have been because the versions in this tutorial had not been updated, however, thanks to Rick’s comment the changes have now been made. The versions in the post are now Python 2.7, Qmake 4.8 and the architecture was changed from ‘i386 to x86_64’.

Edit 01/14 :

If the above didn’t worked for you or if you want a simpler way to install PyQT4 / 5 on OS X you can use homebrew. Once brew installed, simply type the following commands in your terminal :

The installation fails as the root user on my Mac OS X (10.11 El Capitan) cannot write anything to the /System folder. Not sure if this is related to my machine or is a change from Apple or something else.

I spent a lot of time trying the original method. I think the rootless mode on newer macs prevents the SIP make process from working. After struggling for an hour, I found the update with brew instructions. I wish the brew method was at the top.