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.x) and macOS Sierra (10.12.6 at the moment).
Prepare Mac OS X to build Stellarium
First step: Install Apple Developer Tools
- Install the latest version of Apple's Developer Tools: https://developer.apple.com/xcode/
Second step: Install Qt
Option 1: Using the distribution from the Qt Company
- Install the latest stable version of Qt5.10 (5.10.0 at the moment): https://www.qt.io/download-qt-installer (offline installer)
- Add Qt5 to your PATH environment variable, adding to your .bash_profile file the following line:
Option 2: With HomeBrew
Alternatively, you may install Qt with HomeBrew, if you intend to continue the compilation with it (next steps).
- Install HomeBrew: http://brew.sh
- Install latest Qt:
$ brew install qt
- Add Qt to your PATH environment variable, adding to your .bash_profile file the following line:
Third step: Install CMake and git
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.
- If not already done, install HomeBrew: http://brew.sh
- Install CMake:
$ brew install cmake
- Install Git:
$ brew install git
- (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 Git:
$ sudo port install git
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 git command
$ git clone https://github.com/Stellarium/stellarium.git
If you have already done it once, you have just to update your copy using this git command
$ git 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.
Missing Qt Packages
If during the
cmake process, you receive an error like:
CMake Error at CMakeLists.txt:271 (FIND_PACKAGE): By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5Core", but CMake did not find one. Could not find a package configuration file provided by "Qt5Core" with any of the following names: Qt5CoreConfig.cmake qt5core-config.cmake Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set "Qt5Core_DIR" to a directory containing one of the above files. If "Qt5Core" provides a separate development package or SDK, be sure it has been installed.
CMAKE_PREFIX_PATH to the location of the your Qt install, something like
$ export CMAKE_PREFIX_PATH=~/Qt/5.7/clang_64