Building Panda3D on Mac OS X (Leopard)

These are the steps necessary to build Panda3D on Mac OS X. The steps may be different on another system, like a system with Python installed in a different location or via a different method.

Mac OS X Leopard comes with Python 2.5, this is suitable for building and using Panda3D. If you are upgrading from a previous version of Panda3D built on a prior version of Mac OS X you may have remove your old Python installation.

To follow these build instructions you will need MacPorts installed on your system. If you don't already have MacPorts start by downloading and installing it.

Let's get started. First change to your home folder and create a directory to keep the Panda source code. cd by itself changes you to your home folder.

Create a folder for the Panda3D sources

$ cd
$ mkdir src
$ cd src

Grab the latest version of Panda3D's source code.

$ curl -O http://panda3d.org/download/panda3d-1.5.0/panda3d-1.5.0.tar.gz

Extract the source code and change to the Panda3D source directory.

$ tar xzf panda3d-1.5.0.tar.gz
$ cd panda3d-1.5.0

Apply the following patches.

$ curl -O http://edalytical.com/files/patch-stdtypedefs.h
$ curl -O http://edalytical.com/files/patch-fftCompressor.cxx
$ patch -p0 < patch-stdtypedefs.h
$ patch -p0 < patch-fftCompressor.cxx

Install the following packages from MacPorts

$ sudo port install jpeg
$ sudo port install tiff 
$ sudo port install libtar
$ sudo port install ode
$ sudo port install fftw

Build ppremake

$ cd ppremake
$ aclocal
$ autoheader
$ automake --foreign -a
$ autoconf
$ ./configure
$ make
$ sudo make install

Important: change the owner of the Panda install directory.

Replace 'eddie' with your own username.
$ sudo chown -R eddie panda

Setup the build environment in your shell's initialization file

If you use bash this file will be either .bash_profile or .bash_login
# Panda 3D
export PATH="/usr/local/panda/bin:$PATH"
export DYLD_LIBRARY_PATH=/usr/local/panda/lib
export PYTHONPATH=/usr/local/panda/lib:/usr/local/panda/lib/direct:$PYTHONPATH

Source your shell's initialization file.

This is the files you edited above.
$ source ~/.bash_login

Create the Config.pp file

By default this files path is "/usr/local/panda/Config.pp".
#define PYTHON_IPATH /usr/include/python2.5
#define PYTHON_LPATH /usr/lib/python2.5

#define JPEG_IPATH /opt/local/include
#define JPEG_LPATH /opt/local/lib

#define PNG_IPATH /usr/X11/include/libpng
#define PNG_LPATH /usr/X11/lib/

#define TIFF_IPATH /opt/local/include
#define TIFF_LPATH /opt/local/lib

#define TAR_IPATH /opt/local/include
#define TAR_LPATH /opt/local/lib

#define FFTW_IPATH /opt/local/include
#define FFTW_LPATH /opt/local/lib
#define FFTW_LIBS drfftw

#define CG_IPATH /Library/Frameworks/Cg.framework/Headers
#define CG_LPATH /Library/Frameworks/Cg.framework

#define CG_LIBS
#define CG_FRAMEWORK Cg
#define HAVE_CG 1

#define CGGL_LIBS
#define CGGL_FRAMEWORK Cg
#define HAVE_CGGL 1

#define ZLIB_IPATH /opt/local/include/
#define ZLIB_LPATH /opt/local/lib

#define ODE_IPATH /opt/local/include
#define ODE_LPATH /opt/local/lib

Build dtool

$ cd ../dtool
$ ppremake
$ make
$ make install

Build panda

$ cd ../panda
$ ppremake
$ make
$ make install

Build direct

$ cd ../direct
$ ppremake
$ make
$ make install

Run genPyCode

$ genPyCode

Test your installation

$ python
>>> import direct.directbase.DirectStart
>>> run()

If the build succeeded you should see a window with a gray background.

Comments