MacLionCompile — wiki
Pygame Development with Eclipse and Mac OS X Lion¶
This tutorial will explain how to get pygame installed correctly on Mac OS X Lion and additionally how to configure the install with pyDev in eclipse. If you are only interested in one of these two things, have no fear this tutorial won't waste your time. The eclipse specific information is at the bottom of the page all by itself. I decided to write this after struggling through installing pygame on my own machine. I owe many thanks to, and borrowed heavily from, the MacCompile page.
Before the installation process gets started, you'll need to download pygame and its dependencies. The version numbers of the various packages are the ones I had success with on Lion. All of these projects are going to be built from source, and the links below all assume you're downloading the .zip or .tar.gz source code archives. Download links are all listed below:
- python.org Python 2.7 source code (NOTE: At the time of writing this article, the python.org site was down so I can't provide a download link. Will add it next chance I have)
- PyGame 1.9.1 source code download site
- NumPy 1.6.1 source code download site
- JPEG v6 library source code download site
- The download site linked to above is part of sourceforge japan. Not sure how reliable it is long term. The actual file being looked for is titled jpegsrc.v6b.tar.gz. A bit of googling will likely be all that is required to find it.
- PNG Library v1.2.16 source code download site
Building and Installing¶
Now that all the necessary code has been downloaded, we can start to build it. For those unfamiliar and daunted by the idea of compiling source code on the terminal, don't worry. The process is usually no more complicated then typing one or two commands.
Python site still down, will finish this part when I can provide proper links and correct filenames
These are the easiest to install properly. Each of the four frameworks is a disk image. Double click the .dmg files to mount them. For each of the frameworks, navigate to the opened volumes with a terminal. They will all be in locations along the lines of /Volumes/SDL_whatever. Once there, you will run one of the four commands listed below (one for each framework) to copy the files into your Library/Frameworks directory.
sudo cp -R SDL.framework /Library/Frameworks/SDL.framework
sudo cp -R SDL_image.framework /Library/Frameworks/SDL_image.framework
sudo cp -R SDL_ttf.framework /Library/Frameworks/SDL_ttf.framework
sudo cp -R SDL_mixer.framework /Library/Frameworks/SDL_mixer.framework
Installing this component will require actually compiling code. The first step is to remove any existing versions of the library. This can be done with the following command
sudo rm /usr/local/lib/libjpeg.dylib
Now we will unpack, compile, and install the library. Simply navigate to the directory where you download the .tar.gz file and type the following
tar xvzf jpegsrc.v6b.tar.gz
sudo make install-lib
Unfortunately, I'm not able to be at my computer long enough today to finish this. Will add the rest of this in the next couple days.