LoginSignup
4
7

More than 5 years have passed since last update.

ROS installation on Mac OS Sierra

Posted at

This is a complete guide for installing ROS(Robot Operating System) Kinetics bare bone version(no graphing tools due to issues with qt5) on Mac OS Sierra.
Parts of this tutorial borrows from http://wiki.ros.org/kinetic/Installation/OSX/Homebrew/Source

1.Setup
First update brew and install additional cmake tool.
$ brew update
$ brew install cmake

Add ROS dependencies tap and the Homebrew science tap so you can get some non-standard formulae:
$ brew tap ros/deps
$ brew tap osrf/simulation # Gazebo, sdformat, and ogre
$ brew tap homebrew/versions # VTK5
$ brew tap homebrew/science # others

Setup Environment
$ mkdir -p ~/Library/Python/2.7/lib/python/site-packages
$ echo "$(brew --prefix)/lib/python2.7/site-packages" >> ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth

!!!NOTE: Do not use brew python, it will cause error later on when you run commands such as 'rostopic'.
if you have brew python linked:
$ brew unlink python

this command unlinks the brew python and goes back to default system python. If you skip this step, you might have to rebuild everything since ROS builds against python.

if you do not have pip for default python:
$ sudo easy_install pip
$ sudo -H python -m pip install -U pip # Update pip

then init the following packages with pip:
$ sudo -H python -m pip install -U wstool rosdep rosinstall rosinstall_generator rospkg catkin-pkg Distribute sphinx

in order to use rosdep:
$ sudo -H rosdep init
$ rosdep update

2.Installation
Create Catkin Workspace
$ mkdir ~/ros_catkin_ws
$ cd ~/ros_catkin_ws

!!!NOTE: due to qt issues, the only variant that I got working so far does not include any graphing libs
Fetch ROS-Comm: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.
$ rosinstall_generator ros_comm --rosdistro kinetic --deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall
$ wstool init -j8 src kinetic-ros_comm-wet.rosinstall

Resolving Dependencies
$ rosdep install --from-paths src --ignore-src --rosdistro kinetic -y

!!!NOTE: Do not worry if you see the following message afterwards, it is complaining about homebrew python, which you are not using.
Warning: python-2.7.13 already installed, it's just not linked.
ERROR: the following rosdeps failed to install
homebrew: Failed to detect successful installation of [python]

Building the Catkin workspace(this step will take a while, go get yourself a cup of coffee):
$ ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release

Create symbolic links such that the system knows where to find the packages(this step is necessary because we need to let the system know where the libs are located.)
$ cd ros_catkin_ws/install_isolated/lib #navigate to the dir containing all the libs
$ for n in *.dylib; do ln -s $PWD/$n /usr/local/lib/$n; done

3.Running ROS
First run:
$ source ~/ros_catkin_ws/install_isolated/setup.bash
$ export ROS_HOSTNAME='localhost'
the second step is optional depending on the firewall setting on your Mac.

To start the ROS process:
$roscore

If you want to be able to run ROS each time upon opening a terminal, navigate to ~/.bash_profile and add the above two lines.

YOU ARE DONE!

4
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
7