Installing pygame on Snow Leopard's system Python 2.6

  1. Download http://www.libsdl.org/tmp/SDL-1.2.tar.gz
  2. Double-click Xcode.tar.gz, it un-tars as Xcode
  3. Navigate to Xcode/SDL, double-click SDL.xcodeproj
  4. Project menu->Edit Project Settings
  5. Choose "Build" tab, then make sure Deployment_for_official.. is selected in the "configuration" dropdown
  6. Scroll all the way to the bottom, change SDKROOT_i386 and SDKROOT_ppc to /Developer/SDKs/MacOSX10.6.sdk and close the project settings
  7. Make sure that "Use Base SDK", Deployment_for_official_releases..., "Framework", "Standard DMG" and "x86_64" are selected in the Overview menu.
  8. Click Build (you will get warning, but it should compile with no errors)
  9. Copy the "SDL.framework" folder from "Xcode/build/" to "/Library/Frameworks"
  10. Download the pygame source and extract it
  11. Run ./configure.py
  12. Run the following shell commands:

    export CC='/usr/bin/gcc-4.0' CFLAGS='-isysroot /Developer/SDKs/MacOSX10.6.sdk -arch x86_64'

    export LDFLAGS='-arch x86_64'

    export ARCHFLAGS='-arch x86_64'

    python setup.py build

    python setup.py install

The last command may need you to use sudo instead.


Due to a broken "reputation" system I cannot comment on Scott Lyon's post, but I will add that it worked save for one modification: For the last command, I had to specify the installation directory for the Python module like so:

sudo python setup.py install --install-lib /Library/Python/2.6/site-packages/


Have you tried installing it using easy_install or pip?

I haven't tried it yet, but I know I was about to install the needed libraries (SDL_game, etc) via port, then install pygame with

sudo easy_install pygame

Pretty important to get the latest SDL_image.framework if you want actual PNG/JPEG support:

http://www.libsdl.org/projects/SDL_image/

Otherwise it will only load Windows BMP files as you will see this during the build:

/Library/Frameworks//SDL_image.framework/SDL_image, missing required architecture x86_64 in file