Installing Pyglet on 64-bit Macs

January 16th, 2012

Filed under: Game Development, OpenGL | 4 comments

Pyglet is a technology to write cross-platform OpenGL games and applications in Python. If you go to the pyglet site, you will find installers for Mac OS X and Windows. The current Mac version of the installer, 1.1.4, uses Carbon, which means it doesn’t work with 64-bit applications. Not working with 64-bit applications is a problem if you’re running Mac OS X 10.6 and later. Version 1.2 uses Cocoa and works with 64-bit applications, but an installer is not currently available because 1.2 is still in development. Until an installer for 1.2 becomes available, you will have to install pyglet from source code to use version 1.2.

Install Mercurial

The source code for pyglet is in a Mercurial repository. If you do not have Mercurial installed on your computer, you must install it to be able to install pyglet 1.2. Installers for Mac OS X and Windows are available at the Mercurial site.

Clone the Repository

Cloning the pyglet repository gives you a copy of the source code so you can install pyglet. Launch the Terminal application, navigate to where you want the source code to reside, and run the following command:

hg clone pyglet

There is a space before pyglet in the last part of the URL. You should see a pyglet folder after cloning the repository.

Install Pyglet

After cloning the repository, it’s time to install pyglet. In the Terminal application go to the pyglet folder and run the following command:

python install

Now pyglet should be installed and you can start coding.

Install AVbin

Installing pyglet alone has one limitation. It can play only uncompressed audio files. To play compressed audio files, such as MP3 and Ogg Vorbis files, with pyglet, you must install the AVbin library, which is what pyglet uses to play compressed audio. There are multiple versions available for Mac OS X, Windows, and Linux on the AVbin download page. Those of you running Mac OS X 10.6 and later should download a version that supports 64-bit Intel.

After downloading AVbin, you must install it from the Terminal application. Navigate to the avbin folder (the latest name of the folder on Mac OS X is avbin-darwin-x86-64-v8) and enter the following command:

sudo bash

Running the installation script installs AVbin and lets you play compressed audio files with pyglet.



4 thoughts on “Installing Pyglet on 64-bit Macs

  1. Nirvik Baruah says:

    Thanks! Helped a lot. Spent the whole day trying to figure it out then I found this

  2. Masayuki Fujita says:

    Thank you so much! I was struggling for two days to get to piglet to work and viola! Now it does!

  3. […] the scripts like in a previous post didn’t help much.. Luckily a solution shown at Me and Mark Publishing seemed to work out […]

  4. R Guenther says:

    Thanks — I was happy to find this info, as I was struggling to get pyglet working on Yosemite. You made my day!

Leave a Reply

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