Compilation on Mac OS X
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 El Capitan (10.11.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
- Install the latest version of Apple's Developer Tools: https://developer.apple.com/xcode/
- Install the latest stable version of Qt5 (5.5.1 at the moment): http://www.qt.io/download-open-source/ (offline installer)
- Add Qt5 to your PATH environment variable, adding to your .bash_profile file the following line:
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.
- Install HomeBrew: http://brew.sh
- Install CMake:
$ brew install cmake
- Install Bazaar:
$ brew install bazaar
- (optional) Install (and link) Gettext:
$ brew install gettext; brew link gettext --force
Option 2: With MacPorts
- Install MacPorts: http://www.macports.org/install.php
- Install CMake:
$ sudo port install cmake
- 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
$ 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 (see other configuration build options here) ...
$ cmake ../..
... or, if we want a release build (instead of a debug one), ...
$ cmake -DCMAKE_BUILD_TYPE=Release ../..
... and we compile
Optionnaly, we test our build
$ make tests
IMPORTANT: you should delete or move aside the old Stellarium.app before each new build:
$ rm -r Stellarium.app/
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:
- read the link dependencies of Stellarium.app/Contents/MacOS/stellarium,
- copy those dependencies into the app (.frameworks and .dylibs),
- 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.app 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.