Compile In Mac OS X

From FreeOrionWiki
Revision as of 17:05, 22 May 2014 by Vezzra (Talk | contribs) (Rcereation of the "Compile in MacOSX" page. Initial save, contents copied over from the old page, cut the outdated parts, slightly edited the rest.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Latest Version

This section is about compiling the latest version of FreeOrion for Intel Macs with OSX 10.8+. In case you want to compile FreeOrion for older versions of OS X, you're most probably out of luck. You can have a look at the 'Old SDK' section (see below), but the information there is really out of date, it's very likely completely useless by now. But of course, you can try your luck...

Hardware Requirements

Intel Mac

CPU: Mimimum: Core2 Duo; Recommended: Core i5 or better

RAM: Minimum: 4GB; Recomended: 8GB or more (the more the better...)

Software Requirements

Mac OS X 10.8 or later

Xcode 5 or later - Just get the latest version of Xcode from the Mac App Store for free.

Subversion - Subversion should be automatically installed when you install Xcode.

The latest version of the FreeOrion SDK

Build Directions

Preparatory work

Per default Xcode tends to allow too many compiler processes to run in parallel when building a project. When you try to build FreeOrion, this will likely cause Xcode to crash/freeze somewhere during the build process. Depending on your system's specifications it is highly recommended to lower this limit. You can go by trial and error, or you can just go with the following values which have been reported to work so far: 1 for system's with 4GB of RAM, 4 for systems with 8GB of RAM.

This limit can be set by executing the following statements in the terminal (N being the limit you want to set):

  • If you are using Xcode 3: defaults write com.apple.Xcode PBXNumberOfParallelBuildSubtasks N
  • If you are using Xcode 4: defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks N

Step by step

  • Open the SDK .dmg file you've downloded
  • Copy the 'FreeOrionSDK' folder contained there to a directory of your choice
  • Run the bootstrap.sh file inside the copied 'FreeOrionSDK' folder
  • Accept any certificates if SVN asks you to
  • Get a beverage of your choice or go for a walk
  • When FreeOrion has finished updating, close the terminal
  • Open the Xcode project located at 'FreeOrionSDK/FreeOrion/Xcode'
  • If you are using Xcode 4 or later: uncheck "allow debugging when using document revision mode" in the options tab of the run section of the scheme for for FreeOrion, if you don't do this, the resulting FreeOrion app bundle might crash when run (details can be found in this forum thread)
  • 'Active Configuration' must be set to either 'Test' or 'Release'. Note: 'Test' builds the binaries with additional safety checks ("assertions") enabled, resulting in program abortions when these safety checks fail. So, if you aim for serious testing and uncovering of issues, use 'Test', if you just want to happily play with a most up-to-date binary and not be bothered by program abortions because some minor internal safety checks fail, use 'Release'.
  • 'Active Target' must be set to 'FreeOrion'
  • 'Active Executable' must also be set to 'FreeOrion'
  • 'Active Architecture' must be set to 'i386' (it's the only choice anyway)
  • Press 'Command + B'
  • Get another beverage or go for another walk. Note that you computer might turn unresponsive while building (it can take about 40+ minutes for the initial build). There also might occur segfault errors, just let the build process continue until it's finished, then press 'Command + B' again. Lather, rinse, repeat until the build process succeeds. However, this shouldn't take you more then three tries. If it doesn't build after he third try, your computer probably is not up to the task - sorry.
  • If the build succeeds you should see a new folder 'build' in the same directory the Xcode project is in. The newly built FreeOrion app bundle can be found in a folder with the name of the build configuration you've chosen ('Test' or 'Release') inside this 'build' folder.
  • If the build fails, check out the troubleshooting section of this article, or post on the forums


To keep your sources up-to-date you have to use the svn update method before building (Xcode should not run at that time). You can also use Xcode's built-in SVN client, but it is kind of slow.

In a nutshell

  • Download and unpack the SDK
  • Run the bootstrap.sh script
  • Build the project in Xcode

Compilation Errors

You can report errors on the forums.