Install Python 3 & Pygame on Mac OS X Yosemite

This tutorial has been updated from Mavericks to Yosemite. I have tested it and it works perfectly.

Install the Xcode Command Line Tools from Apple. Apple now provides an official Command Line Tools for Xcode package that you can install without needing to install Xcode itself. You can install it with xcode-select –install on Mavericks and Yosemite or download it from Apple’s developer site (free registration required) and search for “Command Line Tools”

Install Quartz from here

Install Homebrew and necessary tools:

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

brew update

brew install python3 (this currently installs version 3.4.3_2)

brew install mercurial

brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
brew tap homebrew/headonly
brew install smpeg

Clone the pygame repository:

cd /Users/YourName/Downloads
hg clone https://bitbucket.org/pygame/pygame
cd pygame
cd src

Copy this file into src, replacing the one there.

Install Pygame:

/usr/local/Cellar/python3/3.4.3_2/bin/pip3.4 install /Users/YourName/Downloads/pygame

That’s it. You can test your install by opening idle3 app located in:
/usr/local/Cellar/python3/3.4.3_2
then type: import pygame [hit return]
if there is no error, you were successful.

If this tutorial helped you, please follow me on twitter @dudeslife .

5 Comments
  1. I have been trying for several days to get pygame working on Yosemite with countless instructions and tutorials. After following these instructions (with a few minor tweaks) I was able to get pygame working with python2 and python3. Thank you for posting these instructions!

  2. This was very helpful. However, when I reached the very last step to install pygame, the script failed with the error message: “-bash: /usr/local/Cellar/python3/3.5.0/bin/pip3.5: /usr/local/opt/python3/bin/python3.5: bad interpreter: No such file or directory” Is a symlink to python3.5 needed?

    • check that the python version you are calling is the one that’s installed.. the version numbers are changing all the time now..

  3. Super. This worked after looking around at older instructions. Also, critical for me to remove “old” python installations

Leave a Reply

Your email address will not be published. Required fields are marked *