Stellarium is an excellent open source application used for astronomy. It is not directly developed for the iMac and OS X, but uses cross platform components which allow it to be compiled on other operating systems.  As development is not OS X specific, it relies on volunteers who give their own time to compile versions for Intel and PPC versions.  Here we will attempt to cover how to compile under OS X on an Intel iMac with Lion from original source code, to make up to date versions easier to compile.  Original source of these notes is the Stellarium website, but we have modified them specifically for our iMac.

 Original Stellarium Wiki link http://stellarium.org/wiki/index.php/Compilation_on_Mac_OS_X

Pre-requisites - OS X:

Tool Source and File Lab Version
You need a machine with Mac OS X 10.4 (latest version 10.4.11) or later.

App Store Lion 10.7.5 / 14/04/2013

Install the latest version of Apple's Developer Tools: http://developer.apple.com/technology/xcode.html
The MacPorts install later in these notes requires 4.1 or later for Lion

Apple's latest Xcode Developer Tools (version 4.4 or later for Mountain Lion, 4.1 or later for Lion), are found at the Apple Developer Connection site, or in the Mac App Store.

Using the latest available version that will run on your OS is recommended. We installed from the App Store. Xcode 4.6.1 in the Mac App Store has been repackaged, and is now distributed as a stand-alone application. This replaces the Install Xcode package, and adds support for delta updates. Xcode includes a new "Downloads" preference pane to install optional components such as command line tools, and previous iOS Simulators.

Apple's Command Line Developer Tools are also found at the Apple Developer Connection site, or they can be installed from within Xcode 4.6.1.

Xcode 4 and later users need to first accept the Xcode EULA by either launching Xcode or running:
xcodebuild -license.

Note: if upgrading from a previous version of Xcode that is not stand-alone, the previous Xcode folders are removed and you may loose other tools installed in these folders - in our case the Qt libraries were removed. This would show up as missing files in CMake. Xcode should be upgraded and the Qt install below re-run if necessary.

App Store 4.6.1 / 14/04/2013

Third party tools required:

Tool Source and File Lab Version
Install the latest version of Qt libraries.

The main pkg file in the dmg will guide you through the steps to getting Qt 4.8.5 Opensource Edition installed on your machine.

After a successful install, you can find most new things in /Developer. Specifically things will be located in the following places:

• Qt Designer, Qt Linguist: /Developer/Applications/Qt
• Qt Documentation: /Developer/Documentation/Qt
• Qt Examples: /Developer/Examples/Qt
• Qt Plugins: /Developer/Applications/Qt/Plugins
• Qt Frameworks: /Library/Frameworks
• Qt Libraries: /usr/lib
• qmake, moc, uic, etc.: /Developer/Tools/Qt (symlink to /usr/bin)

• Uninstall script: /Developer/Tools/uninstall-qt.py

- the above script can be run via terminal and from the /Developer/Tools directory via the command "sudo python uninstall-qt.py" or as "sudo python /Developer/Tools/uninstall-qt.py"

Note this is from the root directory "Developer" not the user sub-directory "Developer".

Qmake, moc etc are searched for in the cmake process.

For Mac OS X there are different versions of Qt - we have chosen the Cocoa version - exclusively for Intel architecture and Mac OS X 10.5 and later. We do not want to create universal binaries on our machine.

Compiling dependencies to build an universal binary - not required here, only testing Intel version !


The above link is to install a version of Qt 4.8.5 without debug chars. This reduces the size of the final app once built.


Installed 03/10/2013

Install MacPorts.

Requires Xcode 4.1 or later for Lion, and its command line developer tools which can be installed from within Xcode itself now.

Macports can be installed from the Macports website listed on the right, once installed you can use the command in Terminal sudo port -v selfupdate to update the current MacPorts install.

Use in Terminal sudo port install intltool (which will install all you need).

To list installed ports use command in Terminal port list installed

To upgrade already installed ports use the command sudo port upgrade outdated




Installed 30/08/2013

Install the latest version of cmake via Terminal using

$ sudo port install cmake


Installed 30/08/2012

Install bazaar making use of macports via Terminal

$ sudo port install bzr


Install from download.




Installed 30/08/2013

Building Stellarium itself:

Step Notes Screen examples

Create a build directory under your user home folder with Finder or shell - the following directory is just an example, you can pick any name and path you want. This directory may already exist for projects if you have used Xcode, and we have used this directory to keep all projects together.

$ mkdir ~/Developer

You only have to do this once, the folder can be re-used.

Finder screen
2 Using 'Finder' open folder 'Developer', if a previous stellarium 'branch' directory exists, then rename 'stellarium_nn' where 'nn' is a number.

3 Using shell change to Developer directory and in that directory checkout the sources with the bzr command - this does require a shell session.  This will download the stellarium source into a new folder called "stellarium", under the "Developer" folder.  Note that at any point you can delete this "stellarium" folder and and start the download process again from step 3.

$ cd ~/Developer

$ bzr branch lp:stellarium stellarium

Screen Print 1

Screen Print 2


To compile stellarium:

Step Notes Screen examples
4 We setup the build directory under the "stellarium" folder once it is downloaded.

$ cd stellarium
$ mkdir -p builds/macosx 

-p: the parameter will also create all directories leading up to the given directory that do not exist already. If the given directory already exists, ignore the error]

$ cd builds/macosx
[Example Screen 3]

If anything goes wrong in later steps we can delete the contents of macosx and start again at step 4.

5 Then we run cmake - No changes to CMakeLists.txt at this time.

$ cmake ../..

6 Then we run make to compile all the objects from the CMake files lists.

$ make



8 To produce the final package that can run as a standalone application:

$ make install

$ make macosx_bundle

The app package is built in macosx.

Typical Build Log
To repeat the process, return to step 2.