How to Install Open Source Routing Machine (OSRM) on macOS
Open Source Routing Machine (OSRM) is a routing engine for OpenStreetMap data. In this tutorial, we'll show you how to install OSRM on macOS.
Prerequisites
Before we begin, you'll need to make sure you have the following prerequisites installed:
- Homebrew - The macOS package manager.
- CMake - A tool used for building software.
You can install both of these by running the following command in your terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install cmake
Installing OSRM
Follow the steps below to install OSRM:
- Open your terminal and run the following command to clone the OSRM repository to your local machine:
git clone https://github.com/Project-OSRM/osrm-backend.git
- Change your working directory to the cloned repository by running:
cd osrm-backend
- Create a new directory named
buildand change your working directory to it:
mkdir build
cd build
- Run the
cmakecommand to generate the Makefile:
cmake ..
- Run the
makecommand to compile and build the binary files:
make
- Finally, run the following command to start the OSRM server:
./osrm-routed ../data.osm.pbf
Verifying OSRM installation
To verify that OSRM has been installed correctly, open your browser and navigate to http://localhost:5000/status. You should see a JSON output containing information about the running OSRM server.
Congratulations! You've successfully installed OSRM on your macOS machine. You can now use OSRM for routing and navigation.