Setting Up the Project

This project is going to be run off of MacOS X. I will be using the package manager Homebrew.. Homebrew helps make sure everything is the correct version, and all apps are installed. It is likely that if you are following this blog post you are familiar with Homebrew, but if not the simple install is as follows:

Open up your terminal of choice (I use the given terminal) and execute the following command

$/usr/bin/ruby -e "$(curl -fsSL"

Next, in order to make sure everything is fine with Homebrew it's best to run

$brew update

and also

$brew doctor

Now we can get to work on downloading everything necessary!

First up, Python (3)!

$brew install python3

A quick way to verify that everything is looking good is to use

$python3 -V

which should spit out something like:

Python 3.7.6

Next, we have a handful of dependencies we have to make sure are installed in order to use Pygame.

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

Lastly, on top of our package manager for Mac, we will be using a package manager for Python, Pip(3)! luckily, Homebrew installs the correct version of pip when you install python. All you have to do to install pygame is the following command:

$pip3 install pygame

Note: the latest version of PyGame did not work for me. I had to use the command $pip3 install pygame=2.0.0.dev3

The quickest way to check if everything so far has been done correctly is to execute the following command:

$python -c "import pygame"

If your output looks similar to the following, PyGame and Python were sucessfully installed.

pygame 2.0.0.dev3 (SDL 2.0.9, python 3.7.6)
Hello from the pygame community. https://www.pygame.ord/contribute.html

Finally, to play a game using PyGame, we will use one of the prebuilt modules.

$python3 -m pygame.examples.aliens