Building Spring on MacOSX

From Spring
Jump to: navigation, search

Development < Building Spring < Building Spring on MacOSX

If you want only to play a spring game, follow the Spring_on_MacOSX Tutorial.

Build from source on MacOSX

Guide is for x86/Intel based OSX installs

I am hoping that with our efforts on the forum that we can have an .app bundle released everytime spring is updated and that will save most people needing to go through the headache of compiling from source code. But if you must try, then here's the steps to help!

I cannot stress enough that this will most likely only work on Intel based systems at this stage. With my understanding of how unitsync works, it seems like online play will not be possible between PPC and x86 architecture.

Get Dependencies

Install the Xcode developers package (this requires a free membership to apple's ADC website) and mac ports or homebrew.

Using Macports

As hint: set "buildmakejobs" to cpu-core count + 1 in /opt/local/etc/macports/macports.conf. For example:

buildmakejobs 5

Once you have downloaded and configured Macports use these commands to download / compile and install gcc:

sudo port install gcc48

now select the installed gcc as default:

sudo port select --set gcc mp-gcc48
hash -r

if you don't know the installed gcc, type:

port select --list gcc

and now the required dependencies:

sudo port install cmake libsdl2 boost libpng jpeg \
                  tiff libogg libvorbis python27 libdevil git-core binutils \
                  openal p7zip glew freetype +gcc48

binutils are required because of "addr2line", this allows finding bugs.

If all was successful, you are very close to being able to compile Spring naively!

Using Homebrew


brew install sdl2    sdl2_gfx sdl2_image  sdl2_mixer sdl2_net  \
  sdl2_ttf binutils p7zip glew freetype \
openal-soft homebrew/versions/gcc48

Recompile boost library with gcc 4.8:

brew install boost --build-from-source --cc=gcc4.8

Obtaining the Source


(For playing online)

Using Git is the recommended way to get the sources of the engine. In spite of, you can use the official tarballs to compile Spring without git.

Note: Do NOT use the zip-files from github, they are missing important data to compile Spring.

See Building spring for build instructions.


Spring project page at github

Master repo URI: git://
Backup repo: git://

Latest Stable (master branch)

Assuming the GIT command line client is installed, you can clone the repository with

git clone --recursive git:// -b master

and update it with:

git pull --rebase

Bleeding-edge (develop branch)

This will also allow you to make a patch out of the changes you make to the code, and send it to one of the developers with repository access. If you are new to git and github, you may want to have a look at this guide to get you started.

Just as above with a minimal change:
git clone --recursive git:// -b develop
and update with:
git pull --rebase
Note: you can switch branches this way:
# backup your current changes
git stash

# switch branch
git checkout $MY_OTHER_BRANCH

# sometimes needed
# note, it deletes all your unstashed changes and all non-pushed commits on the new branch,
# but it doesn't delete untracked files.
#git reset --hard 

# update/sync with remote repo
git pull --rebase

#git stash pop # reapplies your changes and DELETES the backup
#git stash apply --index 0  # reapplies your changes and keep the backup (see `git stash list`)


To obtain the submodules you should clone the repository with --recursive as mentioned above. If you haven't done this, you can execute the following code

git submodule sync
git submodule update --init

To update the submodules, you have to execute the same commands again or pull normally.

Build And Install


Configure and build:

cmake .
make spring

macports-specific instructions:

cmake . -DCMAKE_CXX_COMPILER=${prefix}/bin/g++-mp-4.8 -DCMAKE_C_COMPILER=${prefix}/bin/gcc-mp-4.8 \
-DFREETYPE_INCLUDE_DIR_freetype2=${prefix}/include/freetype2 -DFREETYPE_INCLUDE_DIR_ft2build=${prefix}/include/freetype2 \
make spring

(optional) you can have multiple versions of spring installed - for example, by installing them in a prefix, by adding



cmake .

for example

cmake . -DCMAKE_INSTALL_PREFIX:PATH=/opt/spring/96.0 \
-DCMAKE_CXX_COMPILER=${prefix}/bin/g++-mp-4.8 -DCMAKE_C_COMPILER=${prefix}/bin/gcc-mp-4.8 \
-DFREETYPE_INCLUDE_DIR_freetype2=${prefix}/include/freetype2 -DFREETYPE_INCLUDE_DIR_ft2build=${prefix}/include/freetype2 \

brew-specific instructions:

cmake . -DAPPLE=1 -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc48/4.8.3/bin/g++-4.8 \
-DCMAKE_C_COMPILER=/usr/local/Cellar/gcc48/4.8.3/bin/gcc-4.8 \
-DIL_INCLUDE_DIR=/usr/local/include \
-DGLEW_INCLUDE_DIR=/usr/local/include \
-DOPENAL_DIR=/usr/local/include/AL \


make install-spring