Installation of PyQt on Mac OS X
Rob Oakes | May 12, 2009 5:12 pmNote: The installation instructions in this article apply to Mac OS X 10.5 (Leopard) and Qt 4.5.3. While it is possible to get Qt 4.5.3 to run on Snow Leopard, it requires compiling it from source. Instructions for doing so can be found in the comments below. It is important to note, however, that there are some minor issues with the 4.5 framework on Snow Leopard (including mutlithreaded memory leaks).
You can find instructions for how to install PyQt on Snow Leopard using the Qt 4.7 frameworks at http://blog.oak-tree.us/index.php/2010/05/27/pyqt-snow-leopard.
To install PyQt on Mac OS X, it is also necessary to install and configure the GCC compilers and the Qt framework in addition to SIP and PyQt. The easiest way to get the most current version of the GCC compilers and tools is by downloading the XCode tools package from Apple at the Apple Developer Connection (ADC). ADC requires that you have an Apple ID and account, which are both free. After you log-in, download the XCode developer tools package, which is a bit hefty (nearly 1 GB in size) and may take a while to download depending on your internet speed.
XCode and Qt
While waiting for the XCode tools to download, you can also begin downloading the Qt binary installer from the Trolltech downloads site. As with Windows, I would advise that you you select the complete SDK (which also include pre-compiled binaries) rather than the source release. If you only download the Qt framework, you will need to compile the source yourself which is both time intensive and is not worth the additional headache.
Once XCode has finished downloading, run the package installer. It will ask you to select the destination drive and what components of the software you would like to install.

This will automatically install and configure the GNU tool chain. Once it has finished, you can access the tools by going to the “/Developer/” folder on the root of the drive.
After XCode has finished, run the Qt installer.


The Qt installer package will automatically place the tools and other things that you will need in the same Developer folder where the XCode tools and frameworks are located. You will need to make a note of the path for qmake. The default installation site for qmake is “/usr/bin/qmake-4.5”.
SIP and PyQt
SIP is a program that makes it easy to create C++ bindings program for Python. You can find the source code at Riverbank’s SIP download page. Since we will be using the 4.5 version of PyQt, you will need to download the latest developer snapshot (version 4.8 or greater). Be sure to get the Linux/Unix source code, rather than the Windows source. You will also need the latest source code snapshot for PyQt 4.5, which is also available from Riverbank.
After you have finished downloading the source files, move them to a folder in your Users directory. I have a special directory entitled “Applications” where I keep the source code for programs that I have manually compiled. Note: The rest of the steps will be done from the Mac OS X terminal.
After you have moved the source code for both SIP and PyQt to this new directory, extract it by using the tar utility with the x and f options (tar –xf):
cd ~/Applications
tar -xf sip-4.8-snapshot-20090430.tar
tar -xf PyQt-mac-gpl-4.5-snapshot-20090507.tar
After you have expanded the files, it might be a good idea to rename the directories to something more manageable (like sip-4.8 and PyQt4.5:
mv sip-4.8-snapshot-20090430 sip-4.8
mv PyQt-mac-gpl-4.5-snapshot-20090507 PyQt4.5
First, we need to compile and install SIP. The default configuration will move the compiled files to a directory where Leopard can’t read them. So, we will manually need to specify the destination directory using the –d flag:
cd sip-4.8
python configure.py -d /Library/Python/2.5/site-packages
After the configuration is finished, run make and sudo make install:
make
sudo make install
Once SIP has finished installing, we need to repeat the process for PyQt. From the sip-4.8 directory, chagne to PyQt:
cd ..
cd PyQt4
Next, run the configuration script specifying the path to your version of qmake and the installation directory for the python bindings:
python configure.py -q /usr/bin/qmake-4.5 -d /Library/Python/2.5/site-packages/
Then compile and install:
make
sudo make install
Since Qt is a rather large framework, it may require between 15 and 30 minutes to fully compile.
Tags: PyQt
Categories: Computer, IronPython, Programming
12 Comments »





In addition to nouns, verbs, and adjectives; there are other tools which supplement the writer's arsenal. some writers, this is a moleskin notebook and ballpoint pen. For others, writing is synonymous with the usage of computer word processors, such as Microsoft Word. What is a given, however, is that the choice is intensely personal. If you ask ten different writers, "What is the perfect tool?" Expect ten different answers.

After finishing the 






















![Blackwater: The Rise of the World’s Most Powerful Mercenary Army [Revised and Updated]](http://ecx.images-amazon.com/images/I/41ZopVuqGsL._SL160_.jpg)