Installing Xastir on Mac OS X

I was looking to install Xastir on my Mac but at the time most of the links were dead or incredibly outdated. I have posted this “how to” hoping it may provide you with up to date information on getting Xastir to run on your Mac without having to run it in a VM. This method does involve compiling source code and running the program from a command line so while I did try to lay out the instructions to make it as straight forward as possible it still may be overwhelming to some people. Please proceed with caution if you are not comfortable with doing either action. If you are unsure if this is the best method for you to install and run Xastir on OS X then check out the Xastir install page for other options. Please note that there is not a native OS X application for Xastir.

Step 1: Apple Developer Tools

Before you can get started you will need to make sure you have the Apple developer tools installed on your Mac. If you are unsure you can always do a quick search with spotlight and see if you have an application called Xcode installed. If you do not it means you don’t have the developer tools installed. Xcode is not the only program installed with the tools but it is the one I tell people to look for since it is most likely to be on your drive if you install everything.

If the tools are installed you may precede to the next step. If not, look for the install disks that came with your machine. One of the disks will contain the developer tools. Don’t worry about guessing which disk it is it should be labeled. If you can’t find your install/recovery disks you can also download the tools for free from Apple’s developer page located at http://developer.apple.com/Tools/.

Step 2: X11

You may or may not already have X11 installed on your system. You will need X11 installed to run Xastir on your Mac. In fact X11 is used to run many native Linux application on OS X so you may already have it. Do a search for X11.app to see if you already have it installed. If you don’t you should be able to find it on the disks that came with your system. If you can’t find the disks you can also download X11 from Apple for free at http://www.apple.com/support/downloads/x11formacosx.html.

Step 3:  MacPorts

For the next step we will be using a program called MacPorts. MacPorts is an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system. You can download MacPorts from their website located at  http://www.macports.org.

After you install MacPorts you will need to use it to download and install the necessary packages and libraries used to compile, build and install Xastir. You will be using the terminal application to run MacPorts. Do a search for Terminal.app if you are unsure where the application is located.

Open terminal and type the following command. This will check for the newest version of MacPorts. Since you just downloaded MacPorts it shouldn’t find anything new. But for those who already had it installed it will ensure you are up to date. Please note, any command using sudo will ask for an admin password.

sudo /opt/local/bin/port selfupdate

When the update is done running type this command to start downloading and installing the files you will need. Please note this may take a while depending on the speed of your machine. On my broadband connected 2.8ghz Intel Core 2 Duo iMac with 2GB RAM it took under an hour.

sudo /opt/local/bin/port install curl imagemagick openmotif pcre db42 lcms proj gdal libpng libxml2 shapelib libgeotiff

Step 4: Xastir

Next you will need to download the Xastir source code. You can download it from http://www.xastir.org.  I downloaded it to my home directory but save it to where ever you prefer.

Type the following commands in the terminal window. Please note I used the file name for the current stable version (1.9.4).  Your file name may differ depending on the current version you are using.

First untar the downloaded source code.

tar -xvzf xastir-1.9.4.tar.gz

Next move the untared directory to a directory called xastir.

mv xastir-1.9.4.tar.gz xastir

Change to the new directory.

cd xastir

Run the following commands to build your binary. If you don’t need map caching you can run the configure command by itself with no options.

./bootstrap.sh
./configure –with-bdb-incdir=/opt/local/include/db42 –with-bdb-libdir=/opt/local/lib/db42
make
sudo make install-strip

Everything should be installed and ready to run. To run Xastir open the terminal application and type the following command.

/usr/local/bin/xastir