Can’t install pygame on mac

EDIT: I realized that these steps were originally intended for python3. It should still work for python2, but I can’t confirm, it’s just the best answer I have.

Assuming you are using the newest macOS, here are the steps I used to install pygame. Try and uninstall what you installed for pygame previously, I’m not sure how this could affect it. This will also install the IDLE program, a python IDE developed by python, if you don’t already have it.

If you have an older mac, click the source link at the bottom, which we provide instructions for older macs, which would involve downloading programs like xcode.

  1. Install homebrew. Go into terminal and paste

    ruby -e "$(curl -fsSL https<nolink>://raw.githubusercontent.com/Homebrew/install/master/install)"

    then hit enter.

  2. Paste the following into terminal, hitting enter after each line:

    brew install python (brew install python3 for python3 users)

    brew install mercurial

    brew install sdl sdl_image sdl_mixer sdl_ttf portmidi

    brew tap homebrew/headonly (if you have any trouble here, try brew install --HEAD smpeg instead)

    brew install smpeg

    sudo -H pip install hg+http<nolink>://bitbucket.org/pygame/pygame (You will have to enter your password, and you must be an admin. Python3 users should use sudo -H pip3 install hg+http<nolink>://bitbucket.org/pygame/pygame)

Source (although some info was updated)

Leave a Comment