Building Xplanet

I also rewrote a good part of the scripts I was using and reorganized how things were originally set up. The revisions automate the process of getting Xplanet installed, configured, and executing automatically. The entire bundle is hosted on a secondary repo, different from the Homebrew tap.

The rest of this guide is effectively stepping through what the scripts are doing in detail and explaining how everything is organized.

Download Xplanet Config

In the same terminal window
git clone https://github.com/blogabe/Xplanet.git ~/.xplanet
cd ~/.xplanet/config/scripts

All the necessary files, including a collection of images that we’ll use, now exist in a directory called .xplanet in your home directory. If you’re looking for this in the Mac Finder, you won’t see it because it’s a hidden directory. Use Shift-Command-Dot to alternate Finder displaying or hiding the hidden files and directories.

This is Xplanet’s home directory. Xplanet by default uses ~/Library/Xplanet as its home, but like the config files for most other unix/linux programs, I prefer a dot directory in the home drive.

It’s time to install Xplanet.
./xplanet.sh install

Xplanet Installation

brew tap blogabe/xplanet
brew install -s --HEAD blogabe/xplanet/xplanet --without-giflib --with-cspice
sed -i '' "s#XPLANET_BIN=#XPLANET_BIN=$(/usr/bin/which xplanet)#" ~/.xplanet/config/xp.def

This part of the installation points Homebrew to my tap hosting Xplanet and then builds the binary.

The binary builds from source – unneeded, but explicitly included – with an example of included and excluded options. A description of Xplanet options and what is enabled by default is at the very bottom of this page.

While Xplanet will build from source, Homebrew will download the dependencies required to build it as bottles (the prebuilt binaries). This is absolutely fine.

There is a way to force building the dependencies from source, but it’s not nearly as clean. Run this command before installing Xplanet and the whole bundle will be built directly from source.
brew install --build-from-source \
`brew deps -n --include-build --include-requirements blogabe/xplanet/xplanet [options] | grep -v ':'`

Every now and then there will be an update in macOS, Homebrew, the downstream source that will fail the compilation. You can wait for (or suggest) a fix. In the meantime, you may proceed by forcing a bottle for that particular formula brew install --force-bottle [formula that failed build]. After the bottle is installed, rerun the prior command to continue on from source. You may have to do this more than one time.

Conversely, you can simply order bottle service from Homebrew.
brew install xplanet

Notice the --HEAD designation in the install script. This will install the last working release of Xplanet which supersedes the last official release with bug fixes. You will not receive all the fixes if you use Homebrew’s version.

The last command, sed, updates a file that needs to point to the correct location of the Xplanet binary.

Did you receive an Apple prompt to “Install Java SDK”? You can ignore this. Simply click OK if they appear.

$(xplanet -num_times=1)
$(xplanet -num_times=1)

The next part of the install script executes Xplanet two times. If you end up installing Xplanet outside of the script, you will have to force the run twice as the script does.

Apple Catalina now gates certain parts of the OS for security reasons. The first run of Xplanet will force Apple to prompt for Desktop access approval. The second run will then change the background to something like

xplanet default

Congratulations. Xplanet is installed. Now it’s time to setup the home directory.


Xplanet Build Options

Xplanet, by default, builds with all options enabled. Homebrew’s version, as well as the flavor I manage, only install a subset of options. The options which are excluded by default are typically heavy and install many dependencies. You should install with these options only if you really need their support.

Xplanet Build Options Homebrew Dependency Option Enabled in Homebrew Option Description
–with-freetype freetype Yes TrueType font support
–with-gif giflib Yes GIF graphic library
–with-jpeg jpeg Yes JPEG graphic library
–with-png libpng Yes PNG graphic library
–with-tiff libtiff Yes TIFF graphic library
–with-pango pango No Internationalized text library
–with-pnm netpbm No PNM graphic library
–with-cspice cspice No Support for kernel files containing spacecraft ephemeris

If you want to install Xplanet with all options enabled
brew install -s --HEAD blogabe/xplanet/xplanet --with-all

The build log file is located at ~/Library/Logs/Homebrew/xplanet/01.configure to verify Xplanet compiled with the requested options.

2 Responses to Building Xplanet

Leave a Reply

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