Run Mapbox Tilemill on OSX Yosemite 10.10

The problem

For a few projects I have to use Mapbox’s Tilemill so I can generate mbtile files.  I just booted my Tilemill application for the first time on Yosemite, but it gets stuck and I get a never-ending preloader thingie.  It seems that the app broke with the update to OSX Yosemite 10.10.

Luckily the solution ain’t that hard.  Just build it yourself!

The solution

All you have to do is fork or clone the Mapbox Tilemill git repository and build the source code yourself.

Open Terminal (or your favourite Git repo application like Tower) and execute the following command to clone the repo.

git clone git@github.com:mapbox/tilemill.git

This will download the latest version of Tilemill.

Open Terminal and navigate to the location where you’ve cloned the repo and execute the following command.

npm install

Because Tilemill is actually just a node based application, all you need to do is run the main javascript file.  In the background a node server will be launched and you can access Tilemill in your browser by browsing to http://localhost:20009.

Because it’s cumbersome to navigate via Terminal to your Tilemill installation directory and then execute the Javascript file and then get back to your browser. I’ve added a little shell script which takes care of all these steps.

You just have to create a shell script in the root of your Tilemill installation. I’ve called mine run.sh.

Add the following command to this file and save it.

#!/bin/bash
echo 'Booting Tilemill node server'
chmod a+x index.js
./index.js &
echo 'Waiting for server to boot' &
sleep 3
echo 'Opening browser'
open '/Applications/Google Chrome.app' 'http://localhost:20009'

Navigate to your Tilemill directory in Terminal and type ./run.sh . The script will start the node server (line 2-4), then wait 3 seconds (that’s how long it took on my computer to start the server) and then open my Chrome browser and point to the node server where the Tilemill application is running.

But because I don’t like to be navigating all the time to my Tilemill installation directory in Terminal. I’ve added an alias for this command. Just add the following command in your .aliases, .bash_profile, or whatever file 🙂 Of course you’ll have to change the installation path of Tilemill.

alias tilemill='cd ~/PROJECTS/_libraries/js/tilemill && ./run.sh'

So now I can start my Tilemill application from everywhere in Terminal, by just typing tilemill.  Hope this helps some of you guys out!

 

Tilemill in the browser
Tilemill in the browser
Share this post

2 Responses

Leave a Reply

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

Related Posts