Skip to content

Instantly share code, notes, and snippets.

@brantfaircloth
Created June 14, 2010 17:10
Show Gist options
  • Save brantfaircloth/437957 to your computer and use it in GitHub Desktop.
Save brantfaircloth/437957 to your computer and use it in GitHub Desktop.
Steps to get a working py2app
## Roll your own python from source:
wget http://www.python.org/ftp/python/2.6.5/Python-2.6.5.tgz
tar -xzvf Python-2.6.5.tgz && cd Python-2.6.*
./configure --enable-framework=/Library/Frameworks --with-universal-archs=intel --enable-universalsdk=/
make
sudo make install
# Update the symlink for `python` (and check others)
cd /Library/Frameworks/Python.framework/Versions/2.6/bin/
ln -s python2.6-all python
# Download and build Qt - you need to build the cocoa framework version for i386 and x86_64
wget http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.3.tar.gz
tar -xzvf qt-everywhere-opensource-src-4.6.3.tar.gz && cd qt-every*
./configure -cocoa -framework -no-dwarf2 -no-qt3support -release -nomake "examples demos" -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-sql-mysql -no-xmlpatterns -no-accessibility -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-gif -no-libtiff -no-libpng -no-libmng -no-libjpeg -no-openssl -no-nis -no-cups -no-iconv -no-dbus -no-webkit -arch "x86 x86_64" -sdk /Developer/SDKs/MacOSX10.6.sdk
make
sudo make install
# make sure you:
ln -s /usr/local/Trolltech/Qt-4.6.3/bin/qmake /usr/local/bin/qmake
# build SIP for x86_64 and i386
wget http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-4.10.2.tar.gz
tar -xzvf sip-4.10.2.tar.gz && cd sip*
python configure.py --arch=x86_64 --arch=i386
make
sudo make install
# build PyQT4
wget http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-4.7.3.tar.gz
tar -xzvf PyQt-mac-gpl-4.7.3.tar.gz && cd PyQt*
python configure.py
make
sudo make install
# ensure macholib is ≥ 1.2.2. if not:
svn co http://svn.pythonmac.org/macholib/macholib/trunk/macholib/ macholib-svn
cd macholib-svn
python setup.py build
python setup.py install
# install >r90 py2app
svn co http://svn.pythonmac.org/py2app/py2app/trunk/ py2app-svn
cd py2app-svn
python setup.py build
python setup.py install
@kennethreitz
Copy link

Running through these steps now. Hopefully it'll work, this has been kicking my ass for days.

@brantfaircloth
Copy link
Author

Hopefully, this will pay off. I've been building packages with this setup since I posted it... good luck!

@kennethreitz
Copy link

It did! Works like a charm. Thanks a million man.

@brantfaircloth
Copy link
Author

right on! py2app can be fickle, to say the least. i'll try your updated gist using brew on the next install i have to do...

@kennethreitz
Copy link

Hmm, apps I make with this are fantastic, but only work on Snow Leopard. Have you found this to be the case?

@brantfaircloth
Copy link
Author

Yep. I believe this is due to the fact that everything is built for x86_64 and i386. For these to run on Leopard, they should be 3-way binaries, which also includes PPC - meaning that the entire dependency chain would also have to be built as 3-way binaries (x86_64, i386, PPC). What I don't know is if you go through the process above, adding flags for all 3 ARCHs, if that will build a working py2app and working py2app binaries that run on Leopard. I don't know this because I was largely impatient with the process, which was lengthy enough just to get working applications on 10.6 ; )

I settled for killing backwards compatibility on Leopard, which is a non-optimal solution.

@kennethreitz
Copy link

Yeah, exact same boat I'm in at the moment. I'm going to load Leopard on a mac this weekend and tinker around and see what happens :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment