Installing Eric4 on Mac OS X (Snow Leopard)

As I lately played a little bit with Python on Mac OS X 10.6 Snow Leopard I was looking for a decent IDE.

Unfortunately there are hardly native ones, not to say none. I tried Eclipse with PyDev (which is inbetween also part of Aptana), which works well, but since its an Java app, it’s somewhat sluggish and its look and feel slightly strange in an OS X environment. What I liked better, was Komodo IDE. Based on Mozillas XML Gui (Xul), it integrates at least somewhat better and proved itself as very responsive. However, its propriatery, not free and $295 would be a high price for my occassional use case. The free and now open source Komodo Edit would be an option, but it lacks some features, like an integrated debugger.

So I finally tried to get Eric4 working on  OS X. Its written in Python itself and uses PyQt4, a Python binding for the Qt4 crossplattform-gui-toolkit,  for its GUI. Unfortunately there are no One-Click-and-install builds for the Mac plattform available, so you have to build it yourself from source including all its dependencies. Ok, no problem you think, since there are some install guides available in the net (e.g. here and here), but all of them are missing some pieces or don’t work with current versions. So lets see,  how I did.
(Updated for Snow Leopard, 2010/01/26)

Update2: for an updated and 64bit centred HowTo look here .

1. Python:

Python comes bundled with every OS X install. In 10.6 python version 2.6.1 is installed. So it’s already there.

2. Install Qt4:

Download it from here: http://qt.nokia.com/downloads/mac-os-cpp and install as usual. Btw, I took the binary packages using Cocoa (32-bit and 64-bit). At the time of install it was Qt 4.6.1.

3. Install SIP:

First look at http://www.riverbankcomputing.co.uk/software/sip/download which version is the most current. Mine was 4.10. Open Terminal.app and type:

ftp http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-4.10.tar.gz
tar -xvzpf sip-4.10.tar.gz
cd sip-4.10
python configure.py
make
sudo make install
cd ..

4.Install PyQT:

Now from http://www.riverbankcomputing.co.uk/software/pyqt/download get the current version of PyQt (Mac OS Source). And again in Terminal:

ftp http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-4.7.tar.gz
tar -xvzpf PyQt-mac-gpl-4.7.tar.gz
cd PyQt-mac-gpl-4.7
python configure.py (have to accept licenses by typing 'yes')
make
sudo make install
cd ..

5. Install QScintilla:

For the QScintilla downloadlink look here: http://www.riverbankcomputing.co.uk/software/qscintilla/download.

ftp http://www.riverbankcomputing.co.uk/static/Downloads/QScintilla2/QScintilla-gpl-2.4.2.tar.gz
tar -xvzpf QScintilla-gpl-2.4.2.tar.gz
cd QScintilla-gpl-2.4.2
cd Qt4
qmake qscintilla.pro -spec macx-g++
make
sudo make install

Now make the Qsci module:

cd ../python
python configure.py
make
sudo make install

6. Now install Eric4:

Download a snapshot and and your localisation from from http://sourceforge.net/projects/eric-ide/files/. ‚cd‘ to the regarding folder and:

tar -xvzpf eric4-4.4.0.tar.gz
tar -xvzpf eric4-i18n-de-4.4.0.zip
cd eric4-4.4.0
sudo python install.py
sudo python install-i18n.py

So, ready 🙂

But where is it and how to start?
Eric4 was installed into

/Library/Python/2.6/site-packages/eric4

and you can start it with

eric4

in Terminal.

Obligatory screenshot:

Eric4 at Mac Os X Leopard

Eric4 at Mac Os X Snow Leopard

7. Standalone App

If you find it unpleasant and inconvenient to open Eric every time via Terminal.app and have to have this one open all the time too, its time to build a standalone app. The way to do this is with py2app.

There are some ressources around about deploying Python and PyQt applications on Mac OS X, e.g. here, here, and here, and if you read them, you maybe will see, that it isn’t without hitches. You have to install a prefixed python from macports or python.org besides the system one and such, and things become overcomplicated and follow an unclean approach.

There has to be a way, to use the systems Python, even if it means just to link against it and loose portability over different incarnations of Mac OS X.

I have to admit that I failed at this task so far. As someone new to Python I just have to find my way around. However, what I tried, is … placing a „setup.py“ into the installation directory of Eric4 ( /Library/Python/2.6/site-packages/eric4 ), cd -ing to the dir and did a „sudo python setup.py py2app“ … just to get an error in …. egg/modulegraph/modulegraph.py and a empty build directory. Tried other things like placing the file in the site-packages dir or the source directory of eric4, targeting different files within setup.py, modified the options within what to include and so on, or tried it with the Alias argument (-A). Searching the net for usefull hints, tips and howto’s.

This is the setup.py I started with:

"""
This is a setup.py script generated by py2applet

Usage:
   python setup.py py2app
"""

from setuptools import setup

APP = ['eric4.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True,
'semi_standalone':'False',
'includes': 'Qt4,sip,PyQt4,QScintilla2',
'packages':('Qt4','sip','PyQt4','QScintilla2'),
'site_packages': 'True'}

setup(
   app=APP,
   data_files=DATA_FILES,
   options={'py2app': OPTIONS},
   setup_requires=['py2app'],
)

If you, dear reader, found a way around this last point of making Eric4 feeling at home at OS X please let me now.

[Update 2010/08/09]: Another approach is to use PyInstaller. It seems to still have it quirks on Mac OS X, but there are some workarounds. I haven’t tested it myself, since I’m using Eric4 in a virtual machine with Arch Linux as guest in between, but this site describes exactly all the necessary steps to build a standalone app of Eric4 with PyInstaller.

13 Kommentare zu “Installing Eric4 on Mac OS X (Snow Leopard)”

  1. Ben Chapman

    Thanks for this! It worked perfectly.
    There is a small typo here: „qmake qmake qscintilla.pro -spec macx-g++“
    Only one „qmake“ is needed.

  2. industrie13

    thanks!
    should now be right 😉

  3. richb-hanover

    It’s worth noting that in January 2010, the current versions are:
    Qt4 – 4.6.0
    SIP – 4.9.3
    PyQt – 4.6.2
    QScintilla – 2.4
    eric4 – 4.4.0

  4. Christian

    Have you tried creating an .app using Platypus? Might be worth a shot. Also, on my system (SL 10.6.2) I get a weird display problem: the editor shows „boxes“ around words if one clicks on them. What happens, is that these boxes are somewhat off to the right, and if I click on those words, the whole line shifts to the right to fit into the boxes. Anyone else notice this?

  5. industrie13

    I will give Platus a shot. Regarding the display problem, maybe its caused by the qt4-cocoa-package, which eric is said to have some serious issues with. On the mailing list ( http://www.riverbankcomputing.com/pipermail/eric/2010-January/002271.html ) it was suggested to use qt-mac-opensource-4.6.x.dmg for now (which therefore requires to build PyQt4 in 32bit). I will try that too.

  6. Christian

    Does building a 32bit PyQt4 imply the use of a 32 bit Python? I would rather use the stock Python which comes installed with SL. This whole 32/64 bit thing with SL is kind of a PITA 😉

  7. Henrique

    Thank you for collecting all the installation steps here.

    An easy hack to create a Mac OS X native application is to create an Automator app launching the Eric4 script. In Automator, choose the „Create new app“ option and then select the „run Shell script“ action in the „Utilities“ section. Choose the „/bin/sh“ shell and put as text of the script: „cd /Library/Python/2.6/site-packages/eric4/ &&“, the content of the eric4 launching script (cat /usr/bin/local/eric4) and finally add „&“

    The final result should be something like:

    cd „/Library/Python/2.6/site-packages/eric4“ && exec „/System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw“ „/Library/Python/2.6/site-packages/eric4/eric4.py“ „$@“ &

    If you then save the Automator app, you can change it the icon and launch the eric4 IDE as any other OS X app. Not quite elegant but it works.

  8. Riccardo

    Hi, thank you for this guide. Unfortunely I don’t know why it didn’t work for me. I downloaded Qt for 32 and 64 bit. But when I tried to install eric4 I found this error:

    rrmacbpro:eric4-4.4.2 riccardorotondo$ sudo python install.py
    Checking dependencies
    Python Version: 2.6.4
    Sorry, please install PyQt4.
    Error: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/QtCore.so, 2): no suitable image found. Did find:
    /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/QtCore.so: mach-o, but wrong architecture

    Thanks to anyone can help me.
    Bye

  9. industrie13

    Hi Ricardo, it says, that it couldn’t find PyQt4 – did you install it like in step 4 of the guide above?

  10. Peter

    I always get a failure on make for PyQT. SIP seems to install just fine but on PyQT a python configure.py checks fine, determines the install directory just fine but then gets an error on sip:

    sip: Usage: sip then all the parameters printed out then next line
    Error: Unable to create the C++ code.

    and of course PyQT will not make install.

  11. WORKS13 • » Howto install Eric4 on Mac OS X with 64bit Python

    […] Python became the default on OS X, and the question arised, how to deal with it in regard to Eric4. My old HowTo was very well received, but it covers mostly 32bit installation and therefor caused some […]

  12. ArrantSquid

    For folks getting errors when building try using this for SIP: python configure.py –d /Library/Python/2.6/site-packages
    and this for PyQt: python configure.py –d /Library/Python/2.6/site-packages/

    When you build QScintilla though, do not pass it the -d argument. Just do it normally or it wont build correctly.

    And as far as the Automator build goes to make it an app, you don’t need to do anything other than add a shell script and then type „eric4“ in it.

  13. vlad

    200mb only for QT is too much 🙁

Einen Kommentar schreiben