Installing on OS X from source with Homebrew
Note: These instructions are known to have issues. It is recommended to use the electric version of ROS on OS X for now.
Install from source requires that you download and compile the source code on your own. Starting in ROS Fuerte, installation is in two phases:
Download and install the core ROS libraries and tools using CMake
Download and build remaining ROS libraries/apps using rosmake
This is different from previous ROS distributions, so please take note.
Contents
Installation
Start by installing Homebrew and configuring the environment to use Homebrew.
Install Homebrew
In order to install Homebrew you need to satisfy some requirements.
Homebrew Requirements
- An Intel CPU
- OS X 10.5 or higher
Apple doesn't include an X Windows server anymore, so you need to install Quartz X Windows Server
Command Line Tools for Xcode or Xcode 4
XCode 4.3: Command Lines Tools is now an optional install. You’ll need to enable under Preferences > Downloads.
Install Homebrew
You can install Homebrew, after satisfying the requirements, by running this script in Terminal.app:
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
Once the installation is completed update Homebrew to ensure the latest sources:
brew update
Prepare Environment for Homebrew
You will need to add these lines to your ~/.bashrc to have Homebrew be at the front of the PATH.
export PATH=/usr/local/bin:$PATH export PYTHONPATH="/usr/local/lib/python2.7/site-packages:/usr/local/lib/python:$PYTHONPATH"
In order for the above changes to take effect reopen the terminal or run this command:
source ~/.bashrc
Add the ROS Fuerte Homebrew Tap
Execute the following line to add the official ROS Fuerte Homebrew repository ("tap" in Homebrew terminology).
brew tap ros/fuerte
Bootstrapping
In order to install the first part of ROS some system dependencies need to manually be satisfied.
Env Setup
export ROS_OS_OVERRIDE=osx:homebrew
Python Dependencies
Change the permissions of your Python, Ruby, and Perl library directories to prevent the need for sudo when running pip. This is recommended by the Homebrew developers, but not strictly necessary.
sudo chown -R $USER /Library/Ruby /Library/Perl /Library/Python
Install pip and setup tools from easy_install:
easy_install pip easy_install setuptools
Install the PyYAML dependency by executing the lines below:
brew install libyaml pip install -U PyYAML
Install Mercurial:
pip install mercurial
Install some Catkin Python Dependencies:
pip install -U empy nose
Homebrew Dependencies
Install some other dependencies for the Catkin based ROS stacks to be installed:
brew install cmake cd /usr/local && git checkout 57665ff /usr/local/Library/Formula/boost.rb brew install boost cd /usr/local/Library/Formula && curl -O https://raw.github.com/mxcl/homebrew/ac18935be50d603a64363ba9104b91c643992dce/Library/Formula/gtest.rb brew install gtest brew install log4cxx brew install qt brew install ros/fuerte/swig-wx
Binary Dependencies
Install wxPython by downloading and installing the binary distribution from their development website: http://downloads.sourceforge.net/wxpython/wxPython2.9-osx-2.9.4.0-cocoa-py2.7.dmg
At least Mountain Lion has problems with package format. After mounting the image you have to run
$ sudo installer -pkg /Volumes/wxPython2.9-osx-2.9.4.0-cocoa-py2.7/wxPython2.9-osx-cocoa-py2.7.pkg/ -target /
After installing wxPython from the binary, you need to add this line to your ~/.bashrc in order for ROS to find it:
export PATH=/usr/local/lib/wxPython/bin:$PATH
Make sure to make the changes take effect:
source ~/.bashrc
Install the nVidia CG toolkit for rViz by download their installation package: http://developer.download.nvidia.com/cg/Cg_3.1/Cg-3.1_April2012.dmg
rosinstall
The following steps requires two separate installation steps and will compile ROS-related code into two separate places/layers:
Download and install the underlying core ROS libraries and tools into /opt/ros/fuerte.
Download and build some higher-level ROS libraries using rosmake in ~/ros.
The compiled code from (1) is installed into /opt/ros/fuerte. While it is possible to install elsewhere (e.g. /usr), this is not well tested and you will encounter various problems along the way (e.g. having to change rosinstall files, having to manually install system dependencies, etc...). Please see REP 122: Filesystem Hiearchy Layout for more detailed documentation on how the installed files are placed.
The compiled code from (2) is simply built using rosmake, which is familiar to users of previous versions of ROS. The higher-level ROS stacks are download and build in subdirectories inside the ~/ros directory.
First install rosinstall, rospkg and rosdep as described in their instructions:
If you have trouble using rosws/rosinstall, you can manually download the projects by investigating the respective rosinstall file.
Layer 1: Install core libraries
The following instructions will create a system install of the core ROS libraries and tools. The installation is done using standard CMake/make tools, so experts can adjust to their liking.
ROS-Full: ROS package, build, communication, tutorials and graphical tools.
rosinstall --catkin ~/ros-underlay http://ros.org/rosinstalls/fuerte-ros-full.rosinstall
ROS-Base: (Bare Bones) ROS package, build, and communication libraries.
rosinstall --catkin ~/ros-underlay http://ros.org/rosinstalls/fuerte-ros-base.rosinstall
For people having trouble with rosinstall or catkin on their particular OS: If you have downloaded the source files in a different way, you need to run catkin_init_workspace ~/ros-underlay. This script is part of catkin, which should by now also at least be in your workspace, you can use the script without installing catkin. It should create a suitable global CMakeLists.txt to use in the next step.
If you do not want to use catkin, follow standard cmake procedure for building cmake packages, and install the packages in the dependency order by manually checking the package.xml declarations.
Build and install the underlay into /opt/ros/fuerte:
cd ~/ros-underlay mkdir build cd build
Now, run cmake. The invocation depends on the platform you are on:
- Debian-based platforms (e.g. Ubuntu, Mint) use:
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/ros/fuerte
Other platforms use:cmake .. -DCMAKE_INSTALL_PREFIX=/opt/ros/fuerte -DSETUPTOOLS_DEB_LAYOUT=OFF
Finally, build + install the code:
make -j8 sudo make install
Useful TIP: If you encounter problems with the make command due to "Unable to find 'swig.swg'" and "Unable to find 'python.swg'" errors then it probably due to the installation script having placed /swig at the toplevel/root directory.
To get around this problem do the following (and then restart make process as above)
cd / sudo cp -r /swig /usr/local/share cd ~/ros-underlay/build
Useful TIP: If you are having trouble with the make install command due to lib64 and lib problems, a work around is
cd /opt/ros/fuerte/ sudo mv lib/* lib64/ sudo rmdir lib sudo ln -s lib64 lib
This makes the lib and the lib64 directory linked together and the make install command should work now.
Verify the installed environment:
. /opt/ros/fuerte/setup.sh which roscore
You should see:
/opt/ros/fuerte/bin/roscore
You can delete ~/ros-underlay now, if you wish. The ROS core libraries are now installed onto your system.
Layer 2: Higher-level robotics libraries and tools
Now it's time to create the second layer, which contains your main robotics libraries (e.g. navigation) as well as visualization tools like rviz. You will build this layer using rosmake, but it is not installed.
There are many different libraries and tools in ROS. We provided four default configurations to get you started.
NOTE: The rosinstall installation files below assume that you've installed into /opt/ros/fuerte, so you will need to change them manually if you have a different install path.
Desktop-Full Install: (Recommended): ROS Full, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception
rosinstall ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=fuerte&variant=desktop-full&overlay=no"
Desktop Install: : ROS Full, rviz, and robot-generic libraries
rosinstall ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=fuerte&variant=desktop&overlay=no"
NOTE: the instructions above download all stacks inside the ~/ros folder. If you prefer a different location, simply change the ~/ros in the commands above.
Please reference REP 113 for description of other available configurations.
Environment Setup
You'll now need to update your environment. You can do this by typing:
source ~/ros/setup.bash
It's convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched, which you can do with the command below:
echo "source ~/ros/setup.bash" >> ~/.bashrc . ~/.bashrc
You'll now need to update your environment. You can do this by typing:
source ~/ros/setup.zsh
It's convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched, which you can do with the command below:
echo "source ~/ros/setup.zsh" >> ~/.zshrc . ~/.zshrc
Build Higher-level/tools (Layer 2)
First, initialize your rosdep. ROS Fuerte comes with rosdep 2. If you get a message that your default sources list exists, then don't worry as it means you've done this before.
sudo rosdep init rosdep update
Now, use rosdep 2 to install system dependencies. Many of the system dependencies will install into /opt/ros/fuerte and will not be usable if you have changed the installation prefix.
rosdep install -a
Useful TIP: to get rid of constant prompts of being sure with proceeding, you can use -y switch to tell the package manager to default 'Yes' while installing.
rosdep install -ay
Finally, build the ROS stacks using rosmake.
rosmake -a
Troubleshooting
Swig repo not found
The swig repo in the formula didn't exist on github anymore. I updated it to use the ros repo... require 'formula'
class SwigWx < Formula
url 'git://github.com/ros/swig-wx.git', {:using => :git, :tag => '1.3.29_fuerte'}
homepage 'http://www.swig.org'
version '1.3.29'
def install
ENV.universal_binary
system "./configure --prefix=#{prefix}"
system "make"
system "make install"
end
end
make -j8 fails
There was an error in ros_comm that caused the make to fail. I applied this patch whcih just got merged into fuerte-dev a few days ago. Ypu can https://github.com/ros/ros_comm/commit/9cd2b7535faed30a4a2f8c9bd1cf2af498f5469c You can apply by doing the following:
cd ~/ros-underlay/ros_comm/
curl https://github.com/ros/ros_comm/commit/9cd2b7535faed30a4a2f8c9bd1cf2af498f5469c.patch | git am
Ogre Fails
If your error looks like this:
PhaseScriptExecution "CMake PostBuild Rules" build/OgreMain/OGRE.build/RelWithDebInfo/OgreMain.build/Script-94150EDFE1B64E4C8B512109.sh cd /Users/william/fuerte_ros/visualization_common/ogre/build/ogre_src_v1-7-3 /bin/sh -c /Users/william/fuerte_ros/visualization_common/ogre/build/ogre_src_v1-7-3/build/OgreMain/OGRE.build/RelWithDebInfo/OgreMain.build/Script-94150EDFE1B64E4C8B512109.sh mkdir -p /Users/william/fuerte_ros/visualization_common/ogre/build/ogre_src_v1-7-3/build/lib/RelWithDebInfo/Ogre.framework/Headers/Threading /Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -exclude .hg -exclude 'CMakeLists.txt' -resolve-src-symlinks /Users/william/fuerte_ros/visualization_common/ogre/build/ogre_src_v1-7-3/OgreMain/include/Threading/* /Users/william/fuerte_ros/visualization_common/ogre/build/ogre_src_v1-7-3/build/lib/RelWithDebInfo/Ogre.framework/Headers/Threading/ /bin/sh: /Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp: No such file or directory make[2]: *** [OgreMain_buildpart_0] Error 127 ** BUILD FAILED ** The following build commands failed: PhaseScriptExecution "CMake PostBuild Rules" build/OgreMain/OGRE.build/RelWithDebInfo/OgreMain.build/Script-94150EDFE1B64E4C8B512109.sh (1 failure) make[1]: *** [installed_osx] Error 65 BUILD FAILED: Plugin_CgProgramManager.dylib not created. Is nvidia-cg-toolkit installed correctly? make: *** [ogre] Error 1
Then you need to patch ogre to use ditto rather than pbxcp (this was removed in Xcode 4.4+).
See: http://answers.ros.org/question/42991/building-rvizogre-on-osx-mountain-lion/