Show EOL distros:
Mac OS X Installation Instructions (10.5 or later)
SVN Based Install (download-and-compile)
Pre Install
Install Apple's Developer Tools: http://developer.apple.com/Tools
Install MacPorts http://www.macports.org/install.php
If you have problems, you may find help at ROS/OSX
ROS will work with either Python 2.5 ("py25") or Python 2.6 ("py26"). However, many packages built on top of ROS still use hard-coded py25 dependencies in their rosdep.yaml files. You will have to change each of these if you are using py26. Here are instructions for using Python 2.5:
sudo port -v selfupdate sudo port install wget cmake py25-yaml python_select sudo python_select python25 sudo ln -s /opt/local/Library/Frameworks/Python.framework /Library/Frameworks/
Note: The symlink step above can fail if you have a system installation of a Python framework (which can happen with more recent versions of OS X). Also, this is probably not the right way to adjust the way that frameworks are located. We invite advice and ideas from OS X users on this issue.
On Mac OS X 10.6, the following additional steps might be needed: sudo easy_install -U pyyaml
sudo port install mercurial
In order for the compiler (and rosboost-cfg) to find the correct versions of your libraries, you'll need something like this in your .bashrc if you don't have it already:
export CPATH=/opt/local/include export LIBRARY_PATH=/opt/local/lib export DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH:/opt/local/lib export PATH=/opt/local/bin:$PATH
If your .profile doesn't already source .bashrc, you'll also need to do that:
echo 'source .bashrc' >> .profile`
rosinstall
The following lines will download the ROS source code using the rosinstall tool, and bootstrap the installation. The installation downloads all ROS stacks in subdirectories inside the ~/ros directory, one subdirectory for each stack in the rosinstall file.
First install rosinstall:
sudo easy_install -U rosinstall
Then use rosinstall to download your preferred C-Turtle variant:
ROS-only: Includes basic ROS and tutorials.
rosinstall ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=cturtle&variant=ros_only&overlay=no"
Base Install: ROS plus robot-generic stacks (e.g. navigation, visualization)
rosinstall ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=cturtle&variant=base&overlay=no"
PR2 Install: ROS plus PR2-specific stacks, including PR2 simulator.
rosinstall ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=cturtle&variant=pr2&overlay=no"
PR2 All Install: ROS plus PR2 and bleeding edge research/experimental stacks.
rosinstall ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=cturtle&variant=pr2all&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.
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
For Zsh users, change the last line of ~/ros/setup.zsh to
source $ROS_ROOT/tools/rosbash/roszsh
before running source ~/ros/setup.zsh Similarly, have the setup script called at the start of each new shell session with
echo "source ~/ros/setup.zsh" >> ~/.zshrc . ~/.zshrc
Mac OS X Installation Instructions (10.6 or later)
Contents
SVN Based Install (download-and-compile)
Pre Install
Install Apple's Developer Tools: http://developer.apple.com/Tools
Install MacPorts http://www.macports.org/install.php
ROS uses Python 2.6 ("py26").
sudo port -v selfupdate sudo port install wget cmake python_select subversion mercurial py26-yaml libyaml sudo port select --set python python26
ROS on OS X uses MacPorts, which requires additional environment setup. If you haven't already configured your computer to use MacPorts libraries, add the following to your .bashrc:
export CPATH=/opt/local/include export LIBRARY_PATH=/opt/local/lib export DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH:/opt/local/lib export PATH=/opt/local/bin:$PATH # To ensure that MacPorts pkg-config can find stuff that rosdep installs in /usr export PKG_CONFIG_PATH=/usr/lib/pkgconfig
You may need to run easy_install to install libyaml:
sudo easy_install -U pyyaml
If your .profile doesn't already source .bashrc, you'll also need to do that:
echo 'source .bashrc' >> .profile
NOTE: Check symbolic links (e.g. using which and ls -la) for python and easy_install to make sure they link to the correct version (/opt/local/bin not /usr/...).
If easy_install is not in /opt/local/bin, you will need to install python-setuptools: sudo port install py26-setuptools
You may need to add this symbolic link in /opt/local/bin: sudo ln -fsv /opt/local/bin/easy_install-2.6 easy_install
rosinstall
The following lines will download the ROS source code using the rosinstall tool, and bootstrap the installation. The installation downloads all ROS stacks in subdirectories inside the ~/ros directory, one subdirectory for each stack in the rosinstall file.
First install rosinstall:
sudo easy_install -U rosinstall
There are many different libraries and tools in ROS. We provided four default configurations to get you started.
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=diamondback&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=diamondback&variant=desktop&overlay=no"
ROS-Full: ROS package, build, communication, and graphical tools.
rosinstall ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=diamondback&variant=ros-full&overlay=no"
ROS-Base: (Bare Bones) ROS package, build, and communication libraries.
rosinstall ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=diamondback&variant=ros-base&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 108 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
For Zsh users, change the last line of ~/ros/setup.zsh to
source $ROS_ROOT/tools/rosbash/roszsh
before running source ~/ros/setup.zsh Similarly, have the setup script called at the start of each new shell session with
echo "source ~/ros/setup.zsh" >> ~/.zshrc . ~/.zshrc
Troubleshooting
For Mac OS X, you may need to create these symbolic links:
sudo ln -sv /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/rosinstall rosinstall sudo ln -sv /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/roslocate roslocate
For Mac OS X, if you see this error when building rosrecord:
Linking CXX executable ../bin/rosplay Undefined symbols: "boost::filesystem3::path::extension() const", referenced from: ros::record::Player::open(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ros::Time, bool)in rosplay.o "boost::filesystem3::path::wchar_t_codecvt_facet()", referenced from: ros::record::Player::open(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ros::Time, bool)in rosplay.o ld: symbol(s) not found
You will need to edit ~/ros/ros_comm/tools/rosrecord/CMakeLists.txt. Change line 22 from:
rosbuild_link_boost(rosplay iostreams system)
to:
rosbuild_link_boost(rosplay iostreams system filesystem)
and re-run the above rosinstall configuration.
Mac OS X Installation using Homebrew Instructions (10.6 or later)
Contents
SVN Based Install (download-and-compile)
Install Xcode 4
Xcode 4 can be installed from the App Store in Lion, it is a free, but it is a large download. It is required before moving forward.
http://developer.apple.com/technologies/tools/
Install Homebrew
First install Homebrew by running this script in the terminal:
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
(Optional) 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
Note: If you chose to do the above add this line to your ~/.bashrc file: export ROS_NO_SUDO_PIP=True.
Environment Setup for Homebrew
Add the following lines to your ~/.bashrc file in order to prepare your environment for use each time you open a terminal:
export CPLUS_INCLUDE_PATH="/usr/local/include:$CPLUS_INCLUDE_PATH" export PYTHONPATH="/usr/local/lib/python2.7/site-packages:/usr/local/lib/python:$PYTHONPATH" export ROS_OS_OVERRIDE=osxbrew:lion
The first line prepends the include directory used by Homebrew so that you can find the headers of Homebrew packages. The second line prepends the default directory for Homebrew-installed Python libraries to the Python path so Python can find them. The third line lets rosdep know that we want to use Homebrew for package resolution.
Execute this line to have these changes take effect:
. ~/.bashrc
Install Necessary Dependencies
Install cmake, autoconf, automake, autogen and libtool for build systems, wget for fetching files, and libyaml for reading configuration files:
brew install wget cmake autoconf automake autogen libtool libyaml --universal
Install pip, which is a package manager for Python, using easy_install:
sudo easy_install pip
Install Mercurial, which is a version control system, and PyYaml, which is a python interface to libyaml:
sudo pip install mercurial pyyaml
Note: If you opt'ed into the permission changes above in the instructions, you will not need to prepend each of the above easy_install and pip statements with sudo.
Add Homebrew-Specific rosdep Entries
There are still several packages lacking proper Homebrew rosdep entries, which define how to resolve dependencies using Homebrew. Run this command to add them to your rosdep.yaml override file, adding the definitions globally:
mkdir -p ~/.ros/ wget http://kforge.ros.org/rososx/homebrew/raw-file/tip/electric/rosdep.yaml -O ~/.ros/rosdep.yaml
rosinstall
The following lines will download the ROS source code using the rosinstall tool, and bootstrap the installation. The installation downloads all ROS stacks in subdirectories inside the ~/ros directory, one subdirectory for each stack in the rosinstall file.
First install rosinstall using pip (advanced options for pip):
sudo pip install -U rosinstall vcstools
There are many different libraries and tools in ROS. We provided four default configurations to get you started.
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=electric&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=electric&variant=desktop&overlay=no"
ROS-Full: ROS package, build, communication, and graphical tools.
rosinstall ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=electric&variant=ros-full&overlay=no"
ROS-Base: (Bare Bones) ROS package, build, and communication libraries.
rosinstall ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=electric&variant=ros-base&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
For Zsh users, change the last line of ~/ros/setup.zsh to
source $ROS_ROOT/tools/rosbash/roszsh
before running source ~/ros/setup.zsh Similarly, have the setup script called at the start of each new shell session with
echo "source ~/ros/setup.zsh" >> ~/.zshrc . ~/.zshrc
Notes About Installing with Hombrew
There a few things that developers should know about using Homebrew.
Pip is used for Python Packages
Homebrew only provides packages that do not ship with OS X or Python packages that cannot be installed via pip. Therefore in addition to Homebrew installing things to /usr/local/, this ROS setup leverages easy_install and pip from the system Python provided by Apple to install Python package dependencies.
Macports Conflicts with Homebrew
Additionally, Homebrew is known to have conflicts with Macports. If you are using Macports and want to try out the ROS with Homebrew setup, I recommend temporarily moving the Macports folder to prevent conflicting libraries:
sudo mv /opt/local /opt/_local
To restore Macports at a later date simply rename the folder back to the original name.
wxPython and wxWidgets are installed from a Binary
Because of difficulties in reproducing a wxPython/wxWidgets build that is cocoa compliant, a development binary installer is used. This installer is downloaded and run automatically for you by rosdep, but you will be prompted for sudo credentials, so if you just rosmake --rosdep-install rviz keep an eye out for rosdep asking for your password.
nVidia CG toolkit is Installed from a Binary
In addition to wxPython, nVidia's CG toolkit is installed from a binary. It will also install automatically and prompt you for sudo credentials.
rosconsole may need an additional patch
In case rosconsole fails to build because of a "g++-4.2 not found" error, use the patch found here: https://code.ros.org/trac/ros/changeset/15411
Cairo may have to be built using clang
In case Homebrew fails to build Cairo, use the following command:
brew install cairo --use-clang
in case OGRE refuses to built
If pbxcp is missing, this is mostly because it was moved to a new location in XCode 4.3, see answer.ros.org for a fix.
In case OGRE refuses to build with the error "BUILD FAILED: Plugin_CgProgramManager.so not created. Is nvidia-cg-toolkit installed?", this fix is known to work:
( cd visualization_common/ogre ; rm installed_osx ; make )
Troubleshooting
Unsigned Certificate (or hang at first `rosinstall`)
You might get this error the first time you run rosinstall:
∫ rosinstall ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=electric&variant=desktop-full&overlay=no" rosinstall operating on /Users/someuser/ros from specifications in rosinstall files /Users/someuser/ros/.rosinstall, http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=electric&variant=desktop-full&overlay=no Installing https://code.ros.org/svn/ros/stacks/ros/tags/ros-1.6.5 to /Users/someuser/ros/ros Error validating server certificate for 'https://code.ros.org:443': - The certificate is not issued by a trusted authority. Use the fingerprint to validate the certificate manually! Certificate information: - Hostname: *.ros.org - Valid: from Thu, 10 Sep 2009 23:16:35 GMT until Wed, 12 Sep 2012 05:05:53 GMT - Issuer: Equifax Secure Certificate Authority, Equifax, US - Fingerprint: fb:45:70:74:bf:12:94:01:05:23:8d:ee:b2:04 (R)eject, accept (t)emporarily or accept (p)ermanently?
Visit https://code.ros.org/ in your web browser, pull up the certificate information, and verify the fingerprint in your browser matches the one shown by rosinstall (or svn co). If it does, simply accept it permanently, by pressing 'p' and 'enter', to solve the problem.
This may also manifest as a hang during your first rosinstall invocation:
rosinstall operating on /Users/someuser/ros from specifications in rosinstall files http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=electric&variant=desktop-full&overlay=no (Over-)Writing /Users/someuser/ros/.rosinstall [ros] Installing https://code.ros.org/svn/ros/stacks/ros/tags/ros-1.6.8 (None) to /Users/someuser/ros/ros
Hit ^C to abort the installation, and try running svn co by hand using the URL in the output above:
svn co https://code.ros.org/svn/ros/stacks/ros/tags/ros-1.6.8 ~/ros/ros
You should then get the same certificate error and prompt above, and you can resolve it as discussed there.
Log4cxx Installation Hangs
There have been reports that during the make install step of installing log4cxx the process will hang. You can sometimes tell this has happened when the cpu usage stays low for a long time during the make install step of log4cxx. This might have to do with the automated install of java when building log4cxx on a "clean" OS X install.
To remedy this simply cancel the process with ctrl-c and then rerun the previous command. It should install successfully the second time through. If it is does not ask a question on http://answers.ros.org/questions/.
`rosconsole` Fails with no g++-4.2
If you get this error when building rosconsole:
mkdir -p bin cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find rosbuild`/rostoolchain.cmake .. [rosbuild] Building package rosconsole [rosbuild] Including /Users/william/ros/ros_comm/clients/roslisp/cmake/roslisp.cmake [rosbuild] Including /Users/william/ros/ros_comm/clients/rospy/cmake/rospy.cmake [rosbuild] Including /Users/william/ros/ros_comm/clients/cpp/roscpp/cmake/roscpp.cmake -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: CMAKE_TOOLCHAIN_FILE -- Build files have been written to: /Users/william/ros/ros_comm/tools/rosconsole/build cd build && make [ 0%] Built target rospack_genmsg_libexe [ 0%] Built target rosbuild_precompile [ 50%] Building CXX object CMakeFiles/rosconsole.dir/src/rosconsole/rosconsole.o make[3]: /usr/bin/g++-4.2: No such file or directory make[3]: *** [CMakeFiles/rosconsole.dir/src/rosconsole/rosconsole.o] Error 1 make[2]: *** [CMakeFiles/rosconsole.dir/all] Error 2 make[1]: *** [all] Error 2 make: *** [all] Error 2
Apply this patch: https://code.ros.org/trac/ros/attachment/ticket/3626/ros_comm-1.6.5-rosconsole_g%2B%2B-4.2.patch
From this ticket: https://code.ros.org/trac/ros/ticket/3626
Mercurial fails with an import error
If you see this error when trying to run hg:
bash-3.2$ hg Traceback (most recent call last): File "/usr/local/bin/hg", line 38, in <module> mercurial.dispatch.run() File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 27, in run sys.exit(dispatch(request(sys.argv[1:]))) File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 40, in dispatch req.ui = uimod.ui() File "/Library/Python/2.7/site-packages/mercurial/ui.py", line 43, in __init__ for f in scmutil.rcpath(): File "/Library/Python/2.7/site-packages/mercurial/scmutil.py", line 399, in rcpath _rcpath = osrcpath() File "/Library/Python/2.7/site-packages/mercurial/scmutil.py", line 371, in osrcpath path = systemrcpath() File "/Library/Python/2.7/site-packages/mercurial/scmutil.py", line 420, in systemrcpath path.extend(rcfiles(os.path.join(p, 'etc/mercurial'))) File "/Library/Python/2.7/site-packages/mercurial/scmutil.py", line 409, in rcfiles for f, kind in osutil.listdir(rcdir) File "/Library/Python/2.7/site-packages/mercurial/demandimport.py", line 86, in __getattribute__ self._load() File "/Library/Python/2.7/site-packages/mercurial/demandimport.py", line 58, in _load mod = _origimport(head, globals, locals) ImportError: dlopen(/Library/Python/2.7/site-packages/mercurial/osutil.so, 2): no suitable image found. Did find: /Library/Python/2.7/site-packages/mercurial/osutil.so: mach-o, but wrong architecture
Then your Python interpreter is running in 32-bit mode. To put it in 64-bit mode:
defaults write com.apple.versioner.python Prefer-32-Bit -bool no
Rosdep failes due to md5 sum mismatch
This likely means that something has changed in one of the rdmanifests that are hosted on kforge.ros.org and you need to update your global rosdep.yaml file by rerunning the following command to get the latest file.
wget http://kforge.ros.org/rososx/homebrew/raw-file/tip/electric/rosdep.yaml -O ~/.ros/rosdep.yaml
wxPython fails to install due to ausparc.com dependency
If wxPython fails to install with a complaint about not being able to download from mirror.ausparc.com, this means that the ~/.ros/rosdep.yaml file has a typo in it. You can fix it by editing the file and substituting wxpython for wxPython as shown:
Turn this:
# Overriding existing wxPython source install
wxPython:
osxbrew:
into this:
# Overriding existing wxPython source install
wxpython:
osxbrew:
This bug can surface when following along the tutorials, in the step where you are asked to install the rxtools package.
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/
Installation Instructions for Groovy in OSX
This page describes how to install Groovy in OSX.
Contents
Setup
Homebrew
First, go to http://mxcl.github.com/homebrew/ to install homebrew.
Next use homebrew to install additional software.
$ brew update $ brew install cmake
And also add our ROS Groovy tap and the Homebrew science tap so you can get some non-standard formulae:
$ brew tap ros/groovy $ brew tap osrf/simulation $ brew tap Homebrew/science
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 lines to your ~/.bashrc to have Homebrew be at the front of the PATH.
export PATH=/usr/local/bin:/usr/local/share/python:$PATH export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"
In order for the above changes to take effect reopen the terminal or run this command:
$ source ~/.bashrc
Additional Tools
Finally, we need to install a few ROS python tools using pip:
$ sudo pip install -U wstool rosdep rosinstall rosinstall_generator rospkg catkin-pkg Distribute
If you don't already have pip install it with:
$ sudo easy_install pip
In order to use rosdep, we need to initialize it:
$ sudo rosdep init $ rosdep update
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 groovy --deps --wet-only > groovy-desktop-full-wet.rosinstall $ wstool init -j8 src groovy-desktop-full-wet.rosinstall
Desktop Install (recommended): ROS, rqt, rviz, and robot-generic libraries
$ rosinstall_generator desktop --rosdistro groovy --deps --wet-only > groovy-desktop-wet.rosinstall $ wstool init -j8 src groovy-desktop-wet.rosinstall
ROS-Comm: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.
$ rosinstall_generator ros_comm --rosdistro groovy --deps --wet-only > groovy-ros_comm-wet.rosinstall $ wstool init -j8 src groovy-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 groovy --deps --wet-only > groovy-robot-wet.rosinstall $ wstool init -j8 src groovy-robot-wet.rosinstall
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 groovy -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.
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/groovy argument to your catkin_make_isolated call.
For usage on a robot without Ubuntu, it is recommended to install compiled code into /opt/ros/groovy 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. Lets do that now before building the rest of ROS:
$ source ~/ros_catkin_ws/install_isolated/setup.bash
Build the rosbuild Packages
Now that you have the catkin ROS packages built and sourced, you can build any of the packages and stacks using the rosbuild build system.
Create a rosbuild workspace
Note: You do not need to do this part of the installation for the ROS-Comm: (Bare Bones) variant as it does not contain any rosbuild packages in it.
Like with building catkin packages, it is convenient to build rosbuild packages in a workspace. Lets create a ROS workspace using rosws:
$ mkdir ~/ros_ws $ cd ~/ros_ws $ rosws init . ~/ros_catkin_ws/install_isolated
Note that we are pointing the ROS workspace to the catkin install location that we built in the previous step. This allows the ROS workspace to always source the catkin install location environment before you use the ROS workspace.
Download ROS Stacks
Now we need to get the dry (rosbuild) components of the variant you chose before. Use the corresponding command for your variant to do this:
Desktop-Full Install: 2d/3d simulators, navigation, robot models and several tutorial stacks
$ rosinstall_generator desktop-full --rosdistro groovy --deps --dry-only > groovy-desktop-full-dry.rosinstall $ rosws merge groovy-desktop-full-dry.rosinstall
Desktop Install (recommended): ROS, rqt, rviz, and robot-generic libraries
$ rosinstall_generator desktop --rosdistro groovy --deps --dry-only > groovy-desktop-dry.rosinstall $ rosws merge groovy-desktop-dry.rosinstall
Now this just setups your rosbuild workspace, you need to tell rosws to fetch the packages still:
$ rosws update -j8
Build the ROS Stack
Once this is done fetching the stack you can source this workspace and then build the stack:
$ source ~/ros_ws/setup.bash $ rosmake -a
Update
Once installation is done, you can update source by using wstool:
$ wstool update -t %DIR_TARGET%
%DIR_TARGET% would be src in the example within this page.
Installation Instructions for Hydro in OSX
This page describes how to install Hydro in OSX. OSX is not officially supported by ROS and the installation might fail for several reasons.
Contents
Setup
Homebrew
First, go to http://brew.sh to install homebrew.
Next use homebrew to install additional software.
$ brew update $ brew install cmake
And also add our ROS Hydro tap and the Homebrew science tap so you can get some non-standard formulae:
$ brew tap ros/hydro $ brew tap osrf/simulation # Gazebo, sdformat, and ogre $ brew tap homebrew/versions # VTK5 $ brew tap homebrew/science # others
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.
export PATH=/usr/local/bin:$PATH
In order for the above changes to take effect reopen the terminal or run this command:
$ source ~/.bashrc
You also need to tell python about modules installed by homebrew. The recommended way of doing this are the following commands:
$ 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: Earlier versions of homebrew required you to additionally add /usr/local/share/python to your PATH, so the added line in your .bashrc might look like this:
export PATH=/usr/local/bin:/usr/local/share/python:$PATH
This is no longer needed.
Note: Previously, it was suggested to set PYTHONPATH as such:
export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"
This is problematic, because PYTHONPATH does not distinguish between different python version. The recommended way is creating a .pth file in the user site-packages as outlined above.
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.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 pip install -U setuptools
Install the following packages using pip:
$ sudo pip install -U wstool rosdep rosinstall rosinstall_generator rospkg catkin-pkg Distribute sphinx
In order to use rosdep, we need to initialize it:
$ sudo rosdep init $ rosdep update
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 hydro --deps --wet-only --tar > hydro-desktop-full-wet.rosinstall $ wstool init -j8 src hydro-desktop-full-wet.rosinstall
Desktop Install (recommended): ROS, rqt, rviz, and robot-generic libraries
$ rosinstall_generator desktop --rosdistro hydro --deps --wet-only --tar > hydro-desktop-wet.rosinstall $ wstool init -j8 src hydro-desktop-wet.rosinstall
ROS-Comm: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.
$ rosinstall_generator ros_comm --rosdistro hydro --deps --wet-only --tar > hydro-ros_comm-wet.rosinstall $ wstool init -j8 src hydro-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 hydro --deps --wet-only --tar > hydro-robot-wet.rosinstall $ wstool init -j8 src hydro-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 hydro -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.
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/hydro argument to your catkin_make_isolated call.
For usage on a robot without Ubuntu, it is recommended to install compiled code into /opt/ros/hydro 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. Lets 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
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.
$ brew update $ brew install cmake
And also add our ROS Indigo 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
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.
export PATH=/usr/local/bin:$PATH
In order for the above changes to take effect reopen the terminal or run this command:
$ source ~/.bashrc
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:
$ 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: Earlier versions of homebrew required you to additionally add /usr/local/share/python to your PATH, so the added line in your .bashrc might look like this:
export PATH=/usr/local/bin:/usr/local/share/python:$PATH
This is no longer needed.
Note: Previously, it was suggested to set PYTHONPATH as such:
export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"
This is problematic, because PYTHONPATH does not distinguish between different python version. The recommended way is creating a .pth file in the user site-packages as outlined above.
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:
$ sudo -H pip install -U wstool rosdep rosinstall rosinstall_generator rospkg catkin-pkg Distribute sphinx
In order to use rosdep, we need to initialize it:
$ sudo rosdep init $ rosdep update
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
Installation Instructions for Jade in OSX
This page describes how to install Jade in OSX. OSX is not officially supported by ROS and the installation might fail for several reasons.
Contents
Setup
Homebrew
First, go to http://brew.sh to install homebrew.
Next use homebrew to install additional software.
$ brew update $ brew install cmake
And also add our ROS Jade 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
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.
export PATH=/usr/local/bin:$PATH
In order for the above changes to take effect reopen the terminal or run this command:
$ source ~/.bashrc
You also need to tell python about modules installed by homebrew. The recommended way of doing this are the following commands:
$ 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: Earlier versions of homebrew required you to additionally add /usr/local/share/python to your PATH, so the added line in your .bashrc might look like this:
export PATH=/usr/local/bin:/usr/local/share/python:$PATH
This is no longer needed.
Note: Previously, it was suggested to set PYTHONPATH as such:
export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"
This is problematic, because PYTHONPATH does not disctinguish between different python version. The recommended way is creating a .pth file in the user site-packages as outlined above.
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.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:
$ sudo -H pip install -U wstool rosdep rosinstall rosinstall_generator rospkg catkin-pkg Distribute sphinx
In order to use rosdep, we need to initialize it:
$ sudo rosdep init $ rosdep update
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 jade --deps --wet-only --tar > jade-desktop-full-wet.rosinstall $ wstool init -j8 src jade-desktop-full-wet.rosinstall
Desktop Install (recommended): ROS, rqt, rviz, and robot-generic libraries
$ rosinstall_generator desktop --rosdistro jade --deps --wet-only --tar > jade-desktop-wet.rosinstall $ wstool init -j8 src jade-desktop-wet.rosinstall
ROS-Comm: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.
$ rosinstall_generator ros_comm --rosdistro jade --deps --wet-only --tar > jade-ros_comm-wet.rosinstall $ wstool init -j8 src jade-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 jade --deps --wet-only --tar > jade-robot-wet.rosinstall $ wstool init -j8 src jade-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 jade -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.
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/jade argument to your catkin_make_isolated call.
For usage on a robot without Ubuntu, it is recommended to install compiled code into /opt/ros/jade 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. Lets 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