Show EOL distros:
NOT SUPPORTED
Mac OS X Installation Instructions (10.6 or later)
SVN Based Install (download-and-compile)
Pre Install
Install Apple's Developer Tools: http://developer.apple.com/technologies/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
Install Git
sudo port install git-core +svn+bash_completion
If your .profile doesn't already source .bashrc, you'll also need to do that:
echo 'source ~/.bashrc' >> ~/.profile
Install bash completion:
cp /opt/local/etc/bash_completion.d/git ~/.git-bash-completion.sh echo "[ -f ~/.git-bash-completion.sh ] && . ~/.git-bash-completion.sh" >> ~/.bashrc . ~/.bashrc
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
You need C++ boost library with a version between 1.41 and 1.47. May you have it installed earlier, then you can enter (with your version):
port installed boost sudo port deactivate boost sudo port activate boost @1.47.0_2
If you have not one of that versions, you have to install it by yourself:
cd /Users/shared svn co -r 85591 http://svn.macports.org/repository/macports/trunk/dports/devel/boost boost_1_47_0_2 cd boost_1_47_0_2 sudo chown -R macports:macports Portfile files sudo port install cd .. rm -rf boost_1_47_0_2
Install other packages
sudo port install pkgconfig eigen
You may need to run easy_install to install libyaml:
sudo easy_install -U pyyaml
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-distribute: sudo port install py26-distribute
You may need to add this symbolic link in /opt/local/bin: sudo ln -fsv /opt/local/bin/easy_install-2.6 easy_install
python-svn issue: python-svn is a pre-requisite, but it must currently be installed from source. Please see http://answers.ros.org/question/28124/os-x-installation-error
Tell rosinstall, that we are planning to install using MacPorts: export ROS_OS_OVERRIDE=osx:macports
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
Troubleshooting
symbolic links
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
CMake
If you get the following error:
cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find rosbuild`/rostoolchain.cmake .. CMake Error at /opt/local/share/cmake-2.8/Modules/Platform/Darwin.cmake:141 (message): CMAKE_OSX_DEPLOYMENT_TARGET (10.6) is greater than CMAKE_OSX_SYSROOT SDK (/Developer/SDKs/MacOSX10.5.sdk). Please set CMAKE_OSX_DEPLOYMENT_TARGET to 10.5 or lower
run this as a fix:
echo "set(CMAKE_OSX_DEPLOYMENT_TARGET 10.5)" >> `rospack find rosbuild`/rostoolchain.cmake
Installation Instructions for Groovy in OSX
This page describes how to install Groovy in OSX. OSX is not officially supported by ROS and the installation might fail for several reasons. This page documents how to install using a new experimental packaging of ROS into Portfiles. For the old (outdated) manual install instructions, see here. Please post any issues found with these instructions to the repository issue tracker.
Contents
Setup
Install Apple's Developer Tools (Xcode 4). After starting Xcode select "Preferences" (⌘,) >> "Downloads". In "Components" you will find Command Line Tools.
Install MacPorts
Clone ROS Repository Locally and Update MacPorts Configuration
First clone the repository to somewhere local (Warning: Use small paths if possible, as long paths have caused issues with catkin and environment chaining):
cd ~ git clone https://github.com/kyonifer/ros-macports.git ros-macports
Now we need to tell MacPorts where the local repository clone is. Do this by adding a file:///path/to/clone/location line to /opt/local/etc/macports/sources.conf:
sudo sh -c 'echo file://$HOME/ros-macports >> /opt/local/etc/macports/sources.conf'
Install the ROS Port
Install the ros-groovy port, which will auto build and install ros-desktop-full along with all dependencies:
sudo port install ros-groovy
This will install everything in /opt/local. To use our freshly built ROS installation, we need to source its setup file:
source /opt/local/setup.bash
Now a quick check to make sure all is working
which roscore /opt/local/bin/roscore
Caveats
- Everything in desktop-full is included in this port except the following:
tf2 tf2_* pcl pcl_* depth_image_proc rviz rqt_rviz
ROS is built against MacPorts OpenCV, so if you want specific functionality to be compiled in to OpenCV be sure to build it before ROS with the correct variants flagged, e.g.:
sudo port install opencv +eigen +opencl +python27 +qt4
The same is true for any other dependencies that ROS brings in which you want custom variants of. (You can list available variants for any port by port variant <port_name>).
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. This page documents how to install using a new experimental packaging of ROS into Portfiles for use with Macports. Please post any issues found with these instructions to the repository issue tracker.
Contents
Setup
Install Apple's Developer Tools (Xcode 4).
- Install the Xcode command line tools via "xcode-select --install" on the command line.
Install MacPorts
- Install python27 and set it as the default system interpreter:
sudo port install python27 sudo port select --set python python27
- Do this even if you have python 2.7.x running on your mac
Clone ROS Repository Locally and Update MacPorts Configuration
First clone the repository to somewhere local:
cd ~ git clone https://github.com/kyonifer/ros-macports.git ros-macports
Now we need to tell MacPorts where the local repository clone is. Do this by adding a file:///path/to/clone/location line to /opt/local/etc/macports/sources.conf:
sudo sh -c 'echo file:///$HOME/ros-macports >> /opt/local/etc/macports/sources.conf'
Note that there are three slashes after file:
Install the ROS Ports
At this point you can install any ros-hydro-* package that you want. Due to some GUI packages not currently compiling, the ros-hydro-desktop_full package is broken. However, the ros-hydro-* packages have full dependency resolution, so installing high-level packages will also build all of their dependencies. For example:
sudo port install ros-hydro-roslaunch sudo port install ros-hydro-common_msgs sudo port install ros-hydro-rosbag
will bring in a lot of the ROS core packages. You can also just build the packages that you want, for a lean install. See the repository for a full list of packages available.
Everything will be installed into /opt/local. As long as ros-hydro-catkin is installed (which is pulled in by every other ros port), we need can source a ROS environment:
source /opt/local/setup.bash
Now a quick check to make sure all is working
which roscore /opt/local/bin/roscore
Caveats
- None of the visualization packages are working yet, which breaks most meta-packages trying to install all of ROS.
ROS is built against MacPorts OpenCV, so if you want specific functionality to be compiled in to OpenCV be sure to build it before ROS with the correct variants flagged, e.g.:
sudo port install opencv +eigen +opencl +python27 +qt4
The same is true for any other dependencies that ROS brings in which you want custom variants of. (You can list available variants for any port by port variant <port_name>). In particular, many ports build by default with X11, such as graphviz and VTK, which may not be what you want.