Skip to content
mathuin edited this page Apr 8, 2013 · 1 revision

The following is a rough guide for getting TopoMC running properly on Mac OS X, or more accurately it's the process that has worked for Nathan Rosenquist on 10.7.5 Lion and 10.8.3 Mountain Lion. It will more than likely work for you in the same environments assuming that you follow these steps carefully, are familiar with command line basics and are willing to read the individual documentations a bit if a piece doesn't work quite right. TopoMC ties together a whole bunch of scientific python libraries and Minecraft-related projects to generate its maps, so this walkthrough is essentially a list of installation instructions for each dependency.

Upgrade Python

The Apple version of Python included in OS X isn't compatible with scipy, a python library that we'll be installing later, so download and install Python for OS X from http://www.python.org/download. The two installations of Python live in different places on your system and shouldn't interfere with one another.

Install Xcode and related tools

Xcode and its command line add-ons are used by several of TopoMC's prerequisites to compile and install on OS X. Search the Mac App Store for Xcode and install it.

After installing, run this command from Terminal to specify the location of Xcode:

  • sudo xcode-select -switch /Applications/

Then go to apple.com/developer, register your Apple ID as a developer and log in with it to get to the developer downloads at https://developer.apple.com/downloads/. Sort by Developer Tools and download "Command Line Tools (Your OS X Version Name) for Xcode". Install from the downloaded .dmg.

Install Git

If you don't have it yet, grab and install Git from https://code.google.com/p/git-osx-installer/.

Install Python-related dependencies

All of the add-ons in this step are dependencies for TopoMC's Python scripts.

Download suds from fedorahosted.com/suds/. In Terminal, cd into the uncompressed suds directory and fix permissions on setup.py (not sure about you but I had to chmod all my setup files before running them):

  • chmod 777 setup.py

Then install via the setup file:

  • sudo ./setup.py install

Download progressbar from https://pypi.python.org/pypi/progressbar/2.2. cd into it and fix permissions again:

  • chmod 777 setup.py

And install:

  • sudo ./setup.py install

download libyaml from http://pyyaml.org/wiki/LibYAML. cd into its directory to compile and install it by typing these commands, one at a time (The Xcode tools come in handy here):

  • ./configure
  • make
  • sudo make install

download pyyaml from http://pyyaml.org/wiki/PyYAML. cd into it's directory and just type the following to install it:

  • sudo python setup.py install

Go to the following site to find OS X binaries for GDAL and related software: http://www.kyngchaos.com/software/frameworks. Download the following packages:

  • GDAL Complete
  • GSL framework
  • FreeType
  • cairo

To be honest, I don't know if all of these are required, but the guide I followed at https://sites.google.com/site/eospansite/installinggdalonmacosx suggests that they are and that install order matters, so run the .pkg installers from these downloads in this order:

  1. GDAL Complete
  2. NumPy (Included with GDAL Complete)
  3. GSL Framework
  4. FreeType
  5. Cairo

Download and install gfortran for Xcode 4.2 or later from http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg.

Download and install scipy from sourceforge.net/projects/scipy/files.

Update PATH for sh to include GDAL

GDAL is launched by TopoMC through sh, which isn't OS X's default shell. As such, you need to manually add the PATH for GDAL to the profile for sh. Open up /etc/profile with the command line text editor nano by typing the following into Terminal:

  • sudo nano /etc/profile

Add the following line to the file (I arrow down to the second line and place it after the # hashed-out comment line):

  • export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH

Then type command + X to save the file. Type Y to the overwrite confirmation prompt and then hit return to close nano.

Grab TopoMC

Now it's time to actually install TopoMC onto your drive somewhere. Open Terminal and cd to whatever directory you'd like TopoMC to be in and type the following to clone it in, via git:

Then cd into the cloned TopoMC directory and run the following two commands:

  • git submodule init
  • git submodule update

Test it out!

TopoMC should work now. Test it out by running the example from the TopoMC read me. Be warned: the examples below grab 200+ MB of data from the USGS and as such can take some time to both download and process into a map. If you're not seeing any errors reported in Terminal while they run and are seeing CPU usage in Activity Monitor in the second two tests all should be good):

  • ./GetRegion.py --name Provincetown --ymax 42.0901 --xmin -70.2611 --ymin 42.0091 --xmax -70.1100
  • ./PrepRegion.py --name Provincetown
  • ./BuildRegion.py --name Provincetown

If any errors occur note the name of the problematic module at the end of the trace, and double-check that it was installed correctly.

Optional: Getting BuildMaps.py to run

BuildMaps.py is a tool that utilizes the c10t minecraft mapmaking utility to generate both single image and interactive Google Maps-style renderings of TopoMC maps. Here's a quick workflow for getting it working after you've created a map with TopoMC.

Download and install limping for OS X from http://ethan.tira-thompson.com/Mac_OS_X_Ports.html.

Download boost from http://www.boost.org/users/download/. cd into the downloaded directory and run the following commands to configure and install:

  • ./bootstrap.sh --with-libraries=filesystem,system,test,thread
  • ./bjam stage
  • sudo ./bjam install

Download and install CMake from http://www.cmake.org/cmake/resources/software.html. Pick Install Command Line Links at the end of the install. You may want to change the Install Folder from /usr/bin/ to /usr/local/bin/, which is more commonly used for user-installed tools.

Then finally install c10t by cloning it into a directory via git in Terminal with:

cd into the cloned directory and type the following commands:

  • git submodule init
  • git submodule update

And then build it with the following commands (Note the . in the first line!):

  • cmake .
  • make

Once built, create a /c10t/bin directory with the following command:

  • mkdir bin

Copy the c10t binary file into the new bin directory, and then move the entire c10t directory into your /Applications folder.

The copy of BuildMaps.py that comes with TopoMC looks for c10t in the location it would be installed to on Ubuntu, but since we put it into our OS X /Application folders, we'll now have to make a few minor changes to BuildMaps.py itself to point it at our unique copies of c10t. So open BuildMaps.py in an editor (I just use Textedit) and change any instance of "../c10t/build/c10t" with "/Applications/c10t". I believe there are several, toward the bottom of the file inside main().

And that's it! You should now be able to run BuildMaps.py on the Mac as well!