Skip to content
October 10, 2011 / Chris Merck

Python and Pygame in OSX

Ok, so OSX is not as easy as Arch for getting setup with Pygame/Python. Here’s how I got it working. Comment if this works (or not) for you. These instructions were tested on OSX Snow Leopard, but may work for Lion.

Download and install the following:

  • pygame: download the latest pygame for OSX from here. I used this one. Take a note of the supported python version. In my case it was 2.7.
  • python: Select the latest version from the list that is supported by the pygame you downloaded. I used this one.
  • iTerm 2: this terminal emulator rocks. Get it here. I use it in full-screen mode with vim.
  • MacVim: Of course, everyone uses vim :). But if you prefer a gui, then this is the (best) gVim for OSX.
After downloading be sure to install using the installers for python and pygame, and by dragging the iTerm2 and MacVim apps into Applications.
Now test out pygame using a tutorial such as this one.
If you got a 64-bit-capable version of python, you might have trouble running pygame (since, at the time of writing, pygame is 32-bit only). To force python to run in 32-bit mode, invoke it like this:
 arch -i386 python helloworld.py 
Happy pygaming!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: