This quick guide details compiling sip and PyQt5 on OS X 10.11 (El Capitan) using Homebrew for Qt5 installtion.

In case you don’t have Homebrew installed:

ruby -e "$(curl -fsSL"

Let’s start with installing the latest version of Python 2.x, Qt5, as well as wget using brew:

brew install python qt5 wget

While that is “brewing”, make sure you have Xcode installed (can be installed via the Mac App Store). When Xcode is installed, also make sure you have its command-line tools installed and that you have agreed to Apple’s license agreement:

xcode-select --install
sudo xcodebuild -license

Then let’s download the PyQt5 source for Linux and OS X and the prerequisite SIP source.


Double-check that the newly installed Python 2.7.x is being used when just executing python:

python --version

Untar and compile (also double check the path to your qmake):

tar -xvf sip-4.18.tar.gz
cd /sip-4.18
python -d /usr/local/lib/python2.7/site-packages/
make install

tar -xvf PyQt-gpl-5.6.tar.gz
cd PyQt-gpl-5.6
python -d /usr/local/lib/python2.7/site-packages/ --qmake=/usr/local/Cellar/qt5/5.6.0/bin/qmake --sip=/usr/local/bin/sip --sip-incdir=../sip-4.18/siplib
make install

Please note, you may want want to check out the options in the files prior to configuring/compiling.

You may now import PyQt5 as a module in Python 2.7!

$ python

Python 2.7.10 (default, Sep 23 2015, 04:34:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5