Compilation on Mac OS X

From Stellarium Wiki
(Redirected from Compilation on Macosx)
Jump to: navigation, search

This document describes how to build Stellarium from sources on Mac OS X. This process ought to improve over time.

The set of instructions was written for the 0.13.0 and later releases and using an Intel machine with Mountain Lion (10.8) or later, including Yosemite (10.10.5 at the moment). No universal builds were made since a lot of time (version 0.11.3, 2012-07-31).


Prepare Mac OS X to build Stellarium

First step: Install Developer Tools and Qt

  1. Install the latest version of Apple's Developer Tools:
  2. Install the latest stable version of Qt5 (5.4.2 at the moment): (offline installer)
  3. Add Qt5 to your PATH environment variable, adding to your .bash_profile file the following line: export PATH=~/Qt/5.4/clang_64/bin:$PATH

Second step: Install CMake and Bazaar

You need some tools to build Stellarium on OS X. These tools are CMake and Bazaar. There are (at least) two simple options to install these tools on OS X. Choose only one of them (HomeBrew or MacPorts).

Option 1: With HomeBrew

Simpler, lighter and safer (doesn't need sudo) than MacPorts.

  1. Install HomeBrew:
  2. Install CMake: $ brew install cmake
  3. Install Bazaar: $ brew install bazaar
  4. (optional) Install (and link) Gettext: $ brew install gettext; brew link gettext --force

Option 2: With MacPorts

  1. Install MacPorts:
  2. Install CMake: $ sudo port install cmake
  3. Install Bazaar: $ sudo port install bzr

Last step: Restart terminal session

Don't forget to restart your terminal session, so that your new PATH setting is taken in account.

Building Stellarium itself

Create a build directory with your favorite shell (the following directory is just an example, you can pick any name and path you want)

$ mkdir ~/Development
$ cd ~/Development

Getting Stellarium source code

In that directory checkout the sources with the bzr command

$ bzr branch lp:stellarium stellarium

For more details, see the Bazaar checkout instructions.

If you have already done it once, you have just to update your copy using this bzr command

$ bzr pull

Time to compile Stellarium

We setup the build directory

$ cd stellarium 
$ mkdir -p builds/macosx
$ cd builds/macosx

We run cmake...

$ cmake ../..

... and compile

$ make


Optionnaly, we test our build

$ make tests


IMPORTANT: you should delete or move aside the old before each new build:

$ rm -r

Then make the Mac OS X application:

$ make install
$ make mac_app

The mac_app target includes a python script that makes use of otool and install_name_tool to:

  1. read the link dependencies of,
  2. copy those dependencies into the app (.frameworks and .dylibs),
  3. recurse on those copied-in dependencies, stopping at a point where system libraries are called for.

Creating DMG (Apple Disk Image)

$ mkdir Stellarium
$ cp -r Stellarium
$ hdiutil create -format UDZO -srcfolder Stellarium Stellarium.dmg

We recommend Qt Creator

The core group of developers of stellarium uses QtCreator as main IDE, its integration with Qt and the possibility of having a consistent tool through different platforms makes it the most suitable option for our goals.


All kinds of things might go wrong!

We will write here the most frequent problems and the possible solutions found by the developers.


Personal tools
in this wiki
other languages