First day as a Python/Mac developer

This is primarily just my scattershot notes on getting myself ready for Python and C development on Mac. It really is a confusing picture as to how to get started with Python development on the Mac. You can get a bunch of bits and pieces from the official Mac page for Python , the Python/Mac FAQ and a few other places, but it's hard to put it al together to understand how The OS X bundled Python, MacPython, Fink, MacPorts, framework or non framework, etc. all fit together, and how to navigate the options. It didn't help that important Wiki pages such as the FAQ had been vandalized, and I was not able to fix it for some reason.
It seems to me that the reason for all this confusion is that a person just needing to run some cool Python script they downloaded would go about things in a very different way from someone like me who needs to heavily maintain software that uses advanced Python/C facilities. It all comes down to the split personality that comes from the OS X way of life superimposed upon the UNIX way of life.

Picking a distribution

Also see:

The key section from the FAQ is the following, pasted from the diff of the vandalized page:

Q: Python overload! I've got Apple's Python, Jack's Python, Fink's Python... A: Newcomers to Python-on-X are often confused by the several distributions of Python available. Each flavor has a history and a reason for existance, but if you're starting out, you probably want to look at the "official unofficial" builds of MacPython 2.4 on and install additional packages like numarray or PIL from These builds have a feature set that supersedes that of the beloved 'official MacPython builds' by Jack Jansen and solve many of the obstacles that are described by the FAQ entries on this page.

I followed this advice and went with MacPython, but I also set up MacPorts for some flexibility (see below).

Getting started with MacPython (including setuptools)

I grabbed and installed python-2.5-macosx.dmg dmg/python-2.5-macosx.dmg from the page recommended in the FAQ.

I went with the approach of MacPython in system directories, but packages I build from source in my home directory. This meant the following in my ~/.profile, for a start, added after the "# Setting PATH for MacPython 2.5" section added by the MacPython installer.

export PATH=$HOME/bin:/usr/local/bin:$PATH

export PYVERSION=2.5
export PYSITE=$HOME/Library/Python/$PYVERSION/site-packages

And then the following in ~/.pydistutils.cfg:

install_lib = ~/Library/Python/$py_version_short/site-packages
install_scripts = ~/bin

I also had to do a one-time

mkdir ~/bin
mkdir -p $PYSITE

I used setuptools for the first 4Suite and Amara install, following the OS X specific instructions.
One wrinkle was that Firefox refused to save the page with so I could run it. I tried changing locations and all that to no avail. Smells like a bug. I just used Safari to get it in the end. I noticed that OS X doesn't seem to come with wget. After this set-up, a simple:

easy_install Amara

Worked like a champ, and so I had 4Suite and Amara installed. I also got them set up in CVS easily enough, with the above basic config in place.


I also installed MacPorts, following the install instructions.
I was able to log into Apple Developer Network very easily using my Apple Store ID. One problem is that The instructions say:

Click Customize, expand the Applications category and click the checkbox beside X11 SDK to add it to the default items.

But the XCode 2.4.1dmg I got had "X11 SDK" greyed out. I just went ahead anyway, and it turns out you must install X11 itself before XCode will allow you to install the X11 SDK. Makes sense, but the instructions on the install page have this backward.

As for installing X11 itself, the page says:

Insert the OS X 10.4 installation DVD and run the package named Additional Software.

For the MacBook Pro the installation DVD is labeled "Mac OS X Install Disc 1". The package is actually named "Optional Installs". I clicked through until I got to the page where I could select X11:

You also need to use sudo for the ports update, which isn't clear in the instructions:

sudo port -vd selfupdate

And that's really about as far as I got. I installed MacPorts just to have it handy, just in case. I might first put it to use for wget, which I won't be able to live without very long, and really should come with OS X.

[Uche Ogbuji]

via Copia
2 responses
A couple of hints for surviving without wget for a while.

OS X has curl, which you can make behave like wget by using "curl -O (url)".

Safari has very nice URL download support, including resume and so forth.  You can simply open the download window (Window » Downloads) and paste, at which point the URL will start downloading.  Also, you can double-click icons in the download window to open them (this may not be entirely clear, but it's pretty neat).

And yeah, MacPorts really needs a better organized website.  It hasn't yet entirely recovered from being moved from
If I remember correctly, the only thing that you need to add in your ~/.profile would be the PATH entry.  The PYTHONPATH stuff isn't necessary on OS X, it is added automatically for all framework builds (see