Skip to main content

macintosh — wiki

Current Instructions

Create and add the following to ~/.bash_profile:
     # Homebrew binaries now take precedence over Apple defaults
     export PATH=/usr/local/bin:$PATH

Install Apple Xcode command line tools:
xcode-select --install

Install XQuartz:

Install homebrew:
ruby -e "$(curl -fsSL"

Install Python3 "proper" and packages we’ll need for installing PyGame from bitbucket:
brew install python3 hg sdl sdl_image sdl_mixer sdl_ttf portmidi

Install PyGame:
pip3 install hg+

Restart the Mac for XQuartz changes

Old Instructions

NOTE: this (below) seems out of date, but maybe useful for people on older systems.

I recently installed PyGame 1.9.1 on Mac OS X 10.6 (Snow Leopard) running Python 3.1 - check out the instructions at the bottom of this page: - cheers, and good luck! (Paul Barry, Dec 2009).

Here's how I installed PyGame 1.9.1 on Mac OS X 10.6 (Snow Leopard) for Python 2.7.2.

Pygame on the Macintosh works well using Bob Ipolito's "Framework" build of python 2.4.1 which you can get from here:

In particular, you want both of the following: MacPython-OSX-2.4.1-1.dmg and

After installing the python package you need to update your PATH so that the new version of python will be run instead of the default pre-installed version. You will need to add / usr/local/bin to your PATH, preferably from a .profile file. something like this should do the trick:

echo 'export PATH=/usr/local/bin:$PATH' >> ~/.profile

Note that you will have to start a new Terminal window for this to take effect, or source ~/.profile

To verify that it worked, go to the terminal and run python. You should see the python version number, something like this:

darkside:~ james$ python
Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

If that is NOT what you see, ask for help, and someone will help you find out why the wrong version of python is being run. (if you have already attempted installing a couple different versions of python, this may confuse things a bit.)

After you have verified that you are running python 2.4.1 then you can install extensions from Both the Mac OS X 10.4 and the Mac OS X 10.3+ packages can be expected to work for you. I reccomend a minimum of: pyobjc, numeric, py2app, pygame, and pyopengl

But what if you want to make a game and give it to your other Mac-using friends? Do they have to go through all this trouble too? Nope!

Here is where py2app comes in. You can use it to package your game as a real standalone Mac application with no dependencies. You can just package it in a dmg file and send it to your friends, and they will be able to install your game by dragging it to their hard drive like a proper Mac app should behave. No installers, no terminal voodoo, no need for a particular version of python on their system.

When choosing packages from, the Mac OS X 10.3+ packages are probably preferable even if you are using 10.4 because then py2app packages you make will work on both 10.3 and 10.4.

Alternatively try MacPorts (Formerly Darwinports).

See this thread for running pygame in OS X intel.