Setting the Environment

Prepping your Mac for Xplanet is straightforward.  Like any other binary, you’ll need a compiler, the necessary dependencies and libraries, and the Xplanet source code.  You can certainly download the source for each library individually (listed at the bottom of this page), but the simplest and most straightforward way to get these libraries is to install a package manager system like MacPorts, Fink, or Homebrew.  Package managers are the command line equivalent to Apple’s Mac App Store; they keep everything organized and up to date.

I’m a fan of Homebrew, but MacPorts and Fink will also work.  Homebrew will automatically download the necessary graphic libraries and compile Xplanet with OS X Aqua support enabled.

By the way, the below steps are fully supported on OS X 10.7 Lion through 10.12 Sierra (on the beta release).

The Compiler

You will need a C/C++ compiler whether you decide to use Homebrew, another package manager, or manually install Xplanet and its dependencies, and Apple provides a few different ways to get a compiler onto your Mac.

One way is to download Xcode, Apple’s full-featured IDE to develop applications for OS X and iOS, and then enable the command line tools within the preferences.  Xcode is overkill for our needs and weighs in at ~4GB.  It’s not my preference.

A second way is to grab just the command line tools from Apple’s Developer Site.  You’ll have to register with Apple as a developer – there is no cost – to download the Command Line Tools for OS X Mountain Lion, but we get only what we want/need and takes up only ~150MB of space.  Download the most up to date Command Line Tools DMG file for your version of OS X and install it.

Apple made installing the command line tools even easier starting in 10.9 Mavericks; from the command line:

xcode-select --install

Click Install and then Agree to the terms.

Libraries and Dependencies

Follow the below steps to install .  Check the Options section at the bottom of this page to install all of Xplanet’s dependencies with the –with-all option.

# Execute these steps if you do not already have Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew doctor
brew update
###

brew install xplanet
# or alternately (see below for details)
# brew install xplanet --with-all

You can ignore the “Install Java JDK” dialog that pops up during the process.  It is not needed.  Click OK when is appears.

Please note that Xplanet does not require X11 be default since it utilizes Apple’s Aqua environment.  You will have to install X11 if you prefer to utilize that desktop environment instead.

You can download and install the latest X11 from XQuartz.  Or you can utilize homebrew-cask to also manage your non-binary OS X application installs.  Think of homebrew-cask as an alternative to the official App Store and is built on top of Homebrew itself.

The below steps will “tap” the Casks, install X11, and install Xplanet with X11 enabled.

# Install XQuartz X11 using homebrew-cask
brew tap caskroom/cask
brew cask install xquartz --prefpanedir=/Library/PreferencePanes

brew install xplanet --with-x11

Why Homebrew instead of Fink or MacPorts?  Homebrew installs only additions to OS X, doesn’t require or even want sudo, and utilizes the /usr/local/ directory which is POSIX compliant and unused by Apple.  Fink and MacPorts are too heavy even though they currently support many more packages than Homebrew.  If you are already using Fink or MacPorts, then absolutely continue to use your preferred package management system to install Xplanet.

Why Homebrew instead of manually compiling using “./configure <options> && make && make install”?  Well, we have to get the libraries to compile anyway.  This way is simpler and more organized.  You get the custom compiled binary for your computer, and Homebrew takes care of all the under-the-hood activities and can update the libraries as required.

I also prefer using Homebrew to install Xplanet instead of a manual compilation because the base installation goes into /usr/local/[bin | share/man | share/Xplanet].  I can now add my customizations into my local user directory without impacting the stock installation.  Other users on the system can also customize Xplanet without impacting the stock installation.  And recompiling or upgrading the stock Xplanet installation will not impact any customizations.

 

Xplanet

You’re done.  No need to manually compile.  Homebrew did it for you.  You’ll need to log out and then back in or reboot at this point to get X11 going, but then…  run Xplanet in a terminal window.

xplanet

Xplanet will change your desktop background and show an image of the Earth.

xplanet default

Optional

Now that you have Homebrew installed on your machine, you should consider modifying the /etc/paths file and move /usr/local/bin before /usr/bin and /usr/local/sbin before /usr/sbin.  You don’t have to do this for Xplanet, but say you want to use Homebrew to download a more up to date version of Ruby.  In this case, you’ll have two ruby binaries, the older, stock OS X binary in /usr/bin and the newer, Homebrew compiled version in /usr/local/bin.  Modifying the path priority in the /etc/paths file will ensure the newer version gets executed.

Complete Install of Xplanet

Xplanet, by default, is configured to support PNG, JPEG, TIFF, GIF, PNM, Freetype for TrueType fonts, Pango, and JPLs SPICE toolkit.  Homebrew, by default, will only install a subset of these libraries – everything except PNM, Pango, and SPICE support.

Xplanet Options – Enabled by Default Homebrew Dependency Notes
–with-png libpng Graphic library installed as part of XQuartz X11 installation, but Homebrew will install more current version as part of default install.
–with-jpeg jpeg Graphic library installed as an Xplanet dependency with default install.
–with-tiff libtiff Graphic library installed as an Xplanet dependency with default install.
–with-gif giflib Graphic library installed as an Xplanet dependency with default install.
–with-pnm netpbm Graphic library for PNM support.  Part of “with-all” option.
–with-freetype freetype TrueType font support installed as part of XQuartz X11 installation, but Homebrew will install more current version.  Part of “with-all” option.
–with-pango pango Internationalized text library.  Part of “with-all” option
–with-cspice cspice Support for kernel files containing spacecraft ephemeris

To install the full library complement, install Xplanet with the –with-all option:

brew install xplanet --with-all

To double check the complete installation, open ~/Library/Logs/Homebrew/xplanet/01.configure and check for the following:

  • freetype-config should point to /usr/local/opt/… instead of the X11 installation
  • Support for PANGOFT2 should read yes
  • Support for gif_lib.h should read yes
  • Support for jpeglib.h should read yes
  • Support for png.h should read yes
  • Support for pnm.h should read yes
  • Support for tiff.h should read yes
  • Support for SpiceUsr.h should read yes

 

5 Responses to Setting the Environment

  1. Gautam says:

    brew install location has changed to:
    ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

  2. Gautam says:

    missing the word “brew” in front of:
    install caskroom/cask/brew-cask

    command should be
    brew install caskroom/cask/brew-cask

  3. Gautam says:

    again brew in front of command:
    cask install xquartz –caskroom=/Applications –prefpanedir=/Library/PreferencePanes

  4. Gautam says:

    It worked! Thanks 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *