Compile for Mac

Revision as of 06:57, 15 May 2012 by Mattn (talk | contribs) (Step 2: Install dependencies)

Step 1. Installation

Install Xcode, X11, and MacPorts

Instructions are at This will have you install Apple's X11 (not sure why it is needed), the Xcode development environment (needed for the compiler, etc), and the MacPorts program.

Add headerpad_max_install_names LDFLAGS to MacPorts

Modify /opt/local/share/macports/Tcl/port1.0/portconfigure.tcl configure.ldflags to

default configure.ldflags {"-L${prefix}/lib -Wl,-headerpad_max_install_names"}

This change is only needed if you would like to create dmgs.

Step 2: Install dependencies

sudo port configure libsdl +universal
sudo port install libsdl-framework
sudo port install libsdl_mixer-framework libsdl_ttf-framework
sudo port install jpeg libpng XviD libtheora gtkglext gtksourceview
sudo port install libtheora XviD git-core p7zip python26

Now you should be able to fetch UFO-AI and compile it.

Step 3: Compilation

UFO:AI compilation requires some paths that are not taken care of for you by the MacPorts installation process. Therefore, a minor edit to your .profile is needed.

If you don't understand the preceding sentences: (a) Download TextWrangler (freeware) from ; (b) Use its File > Open to navigate to your home folder and enable its "Show hidden files" option; and (c) Open the ".profile" file you should see now so you can edit it.

Toward the bottom, substitute this export command:

export PATH=$PATH:/opt/local/bin:opt/local/sbin:opt/local

Save the file, quit Terminal, then relaunch Terminal to make the new PATH operative.

Now, the following "make" commands should execute without errors. You should also be able to compile newer versions of UFO:AI without editing .profile again, i.e., this is a one-time fix.

To compile the binaries, just type (after the configure call was successful).


after that, you need to create the languages and maps

make lang models maps-sync

To create the application bundle (i.e., a .dmg), just type

make macinstaller