[Documentation] [TitleIndex] [WordIndex

Because ROS Indigo requires Qt4 and because Homebrew (the macOS package manager) no longer provides formula for Qt4, it is highly recommended to use ROS Kinetic (which uses Qt5) as a starting point on macOS:

http://wiki.ros.org/kinetic/Installation/OSX/Homebrew/Source

Installation Instructions for Indigo in OSX

This page describes how to install Indigo in OSX. OSX is not officially supported by ROS and the installation might fail for several reasons.

Setup

Homebrew

First, go to http://brew.sh to install homebrew.

Next use homebrew to install additional software.

And also add our ROS Indigo tap and the Homebrew science tap so you can get some non-standard formulae:

Note: if you are upgrading from previous ROS distro try:

$ brew untap ros/DISTRO

Note: It is recommended to use the system python rather than homebrewed python because of problems with segmentation faults. http://answers.ros.org/question/108431/import-tf-segfaults-python-on-os-x-109-with-brewed-python/

Setup Environment

You will need to add these line to your ~/.bashrc or ~/.bash_profile to have Homebrew be at the front of the PATH.

In order for the above changes to take effect reopen the terminal or run this command:

Setup Environment for Python

You also need to tell python about modules installed by homebrew. The recommended way of doing this are the following commands:

Additional Tools

Finally, we need to install a few ROS python tools using pip.

If you don't already have pip install it with:

$ sudo easy_install pip

/!\ On OS 10.12 (Sierra), and possibly some older versions, there can be a lot of conflicts with the system python's packages and directories. You might consider using Homebrew's python instead:

$ brew install python

/!\ On OS 10.9 (Mavericks) If pip is installed, check the version installed. If it is not 1.2.1, you will have to delete pip manually and install pip 1.2.1 after deleting:

$ pip --version
$ sudo easy_install pip==1.2.1

/!\ On OS 10.9 (Mavericks) you might need to install a new version of setuptools before you can install rosinstall_generator:

$ sudo -H pip install -U setuptools

Install the following packages using pip:

In order to use rosdep, we need to initialize it:

Installation

Start by building the core ROS packages.

Building the catkin Packages

ROS is in the process of converting to a new build system, catkin, but not all of the packages have been converted and the two build systems cannot be used simultaneously. Therefore it is necessary to build the core ROS packages first (catkin packages) and then the rest.

Create a catkin Workspace

In order to build the core packages, you will need a catkin workspace. Create one now:

  • $ mkdir ~/ros_catkin_ws
    $ cd ~/ros_catkin_ws

Next we will want to fetch the core packages so we can build them. We will use wstool for this. Select the wstool command for the particular variant you want to install:

Desktop-Full Install: ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception

  • $ rosinstall_generator desktop_full --rosdistro indigo --deps --wet-only --tar > indigo-desktop-full-wet.rosinstall
    $ wstool init -j8 src indigo-desktop-full-wet.rosinstall

Desktop Install (recommended): ROS, rqt, rviz, and robot-generic libraries

  • $ rosinstall_generator desktop --rosdistro indigo --deps --wet-only --tar > indigo-desktop-wet.rosinstall
    $ wstool init -j8 src indigo-desktop-wet.rosinstall

ROS-Comm: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.

  • $ rosinstall_generator ros_comm --rosdistro indigo --deps --wet-only --tar > indigo-ros_comm-wet.rosinstall
    $ wstool init -j8 src indigo-ros_comm-wet.rosinstall

This will add all of the catkin or wet packages in the given variant and then fetch the sources into the ~/ros_catkin_ws/src directory. The command will take a few minutes to download all of the core ROS packages into the src folder. The -j8 option downloads 8 packages in parallel.

In addition to the 3 variants above, more are defined in REP 131 such as robot, perception, etc. Just change the package path to the one you want, e.g., for robot do:

$ rosinstall_generator robot --rosdistro indigo --deps --wet-only --tar > indigo-robot-wet.rosinstall
$ wstool init -j8 src indigo-robot-wet.rosinstall

If wstool init fails or is interrupted, you can resume the download by running:

wstool update -j 4 -t src

Resolving Dependencies

Before you can build your catkin workspace you need to make sure that you have all the required dependencies. We use the rosdep tool for this:

  • $ rosdep install --from-paths src --ignore-src --rosdistro indigo -y

This will look at all of the packages in the src directory and find all of the dependencies they have. Then it will recursively install the dependencies.

The --from-paths option indicates we want to install the dependencies for an entire directory of packages, in this case src. The --ignore-src option indicates to rosdep that it shouldn't try to install any ROS packages in the src folder from the package manager, we don't need it to since we are building them ourselves. The --rosdistro option is required because we don't have a ROS environment setup yet, so we have to indicate to rosdep what version of ROS we are building for. Finally, the -y option indicates to rosdep that we don't want to be bothered by too many prompts from the package manager.

After a while (and maybe some prompts for your password) rosdep will finish installing system dependencies and you can continue.

If you installed something from source or from pip and don't want rosdep to try to install it for you use the --skip-keys option. For example if you installed the bootstrap tools such as rosdep, rospkg, and rosinstall_generator from source add the arguments --skip-keys python-rosdep --skip-keys python-rospkg --skip-keys python-catkin-pkg

Building the catkin Workspace

Once it has completed downloading the packages and resolving the dependencies you are ready to build the catkin packages. We will use the catkin_make_isolated command because there are both catkin and plain cmake packages in the base install, when developing on your catkin only workspaces you should use catkin/commands/catkin_make.

Invoke catkin_make_isolated:

  • $ ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release

Note: You might want to select a different CMake build type (e.g. RelWithDebInfo or Debug, see http://cmake.org/cmake/help/v2.8.12/cmake.html#variable:CMAKE_BUILD_TYPE).

Note: The default catkin installation location would be ~/ros_catkin_ws/install_isolated, if you would like to install some where else then you can do this by adding the --install-space /opt/ros/indigo argument to your catkin_make_isolated call.

For usage on a robot without Ubuntu, it is recommended to install compiled code into /opt/ros/indigo just as the Ubuntu packages would do. Don't do this in Ubuntu, as the packages would collide with apt-get packages. It is also possible to install elsewhere (e.g. /usr), but it is not recommended unless you really know what you are doing.

Please see REP 122: Filesystem Hierarchy Layout for more detailed documentation on how the installed files are placed.

Note: In the above command we are running the catkin_make_isolated command from the catkin source folder because it has not been installed yet, once installed it can be called directly.

Now the packages should have been installed to ~/ros_catkin_ws/install_isolated or to wherever you specified with the --install-space argument. If you look in that directory you will see that a setup.bash file have been generated. To utilize the things installed there simply source that file. Let's do that now before building the rest of ROS:

  • $ source ~/ros_catkin_ws/install_isolated/setup.bash

Maintaining a Source Checkout

If we want to keep our source checkout up to date, we will have to periodically update our rosinstall file, download the latest sources, and rebuild our workspace.

Update the workspace

To update your workspace, first move your existing rosinstall file so that it doesn't get overwritten, and generate an updated version. For simplicity, we will cover the *destop-full* variant. For other variants, update the filenames and rosinstall_generator arguments appropriately.

$ mv -i hydro-desktop-full-wet.rosinstall hydro-desktop-full-wet.rosinstall.old
$ rosinstall_generator desktop_full --rosdistro hydro --deps --wet-only --tar > hydro-desktop-full-wet.rosinstall

Then, compare the new rosinstall file to the old version to see which packages will be updated:

$ diff -u hydro-desktop-full-wet.rosinstall hydro-desktop-full-wet.rosinstall.old

If you're satified with these changes, incorporate the new rosinstall file into the workspace and update your workspace:

$ wstool merge -t src hydro-desktop-full-wet.rosinstall
$ wstool update -t src

Rebuild your workspace

Now that the workspace is up to date with the latest sources, rebuild it:

$ ./src/catkin/bin/catkin_make_isolated --install

If you specified the --install-space option when your workspace initially, you should specify it again when rebuilding your workspace

Once your workspace has been rebuilt, you should source the setup files again:

$ source ~/ros_catkin_ws/install_isolated/setup.bash


2024-03-23 12:38