Installing Pygame on Mac

The process of installing pygame on your Mac is somewhat involved. Please follow these steps, which will take about 15 minutes. Some of the steps will ask you to enter the admin password.

  1. Install the Apple Xcode command line tools.
    From a Terminal window, run the following command:
    xcode-select --install

  2. Install XQuartz from http://xquartz.macosforge.org/landing/.

  3. Install Homebrew.
    From a Terminal window, run the following command:
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  4. Install Python 3.
    From a Terminal window, run the following command:
    brew install python3 hg sdl sdl_image sdl_mixer sdl_ttf portmidi

  5. Install PyGame.
    From a Terminal window, run the following command:
    pip3 install hg+http://bitbucket.org/pygame/pygame

To validate that pygame is installed properly, run python3 from the Terminal window. This will start the interactive command line window of Python 3. Now type import pygame and hit return. If you don't see any warnings, congratulations! Pygame is ready to be used. You can type quit() to exit.