Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ROS Kinetic on Sierra Work in Progress
# NOTE: These instructions do not represent a robust, self-troubleshooting install; they
# are definitely not suitable for dumping to a giant script and running as one. If you
# use them, they should be run one at a time, with an eye out for errors or problems
# along the way.
#
# The #1 issue you are likely to encounter is with Homebrew or Python packages whose
# binary components link against system Python. This will result in runtime segfaults,
# especially in rviz. If you suspect this is occurring, you can attempt to remove and
# reinstall the offending packages, or go for the nuclear option--- empty your Cellar
# and site-packages folders and start over with brewed python from the beginning.
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# If a cleanup is necessary, proceed with extreme caution!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# Remove old ROS installations, don't do this tutorial if you have several versions of ros installed
sudo rm -rf /opt/ros
rm -rf ~/ros_catkin_ws
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
# Clean up all python packages
sudo rm -rf /Library/Python/2.7/site-packages
# Uninstall homebrew, warning this will cause trouble for anything linked against older hombrewed libraries
brew install wget
wget https://gist.githubusercontent.com/mxcl/1173223/raw/a833ba44e7be8428d877e58640720ff43c59dbad/uninstall_homebrew.sh
bash uninstall_homebrew.sh && rm uninstall_homebrew.sh
rm -rf /usr/local/Cellar /usr/local/.git
rm -rf /usr/local/Library/Taps
# Comment everything related to ROS in your .bashrc/.zshrc
nano .zshrc
# Now we are ready to start fresh.
# If you haven't already, install XQuartz using the installer from its own website:
# https://xquartz.macosforge.org
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
# Install zshell, if you want to use bash instead, you should change the sourced files from .zsh to .bash
brew install zsh
echo export PATH='/usr/local/bin:$PATH' >> ~/.zshrc
source .zshrc
# Install brewed python
brew install python
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
# Homebrew taps for prerequisites
brew tap ros/deps
brew tap osrf/simulation
brew tap homebrew/versions
brew tap homebrew/science
brew tap homebrew/dupes
brew tap dartsim/dart
# Prerequisites
brew install qt5
brew link --force qt5
brew install opencv3 --HEAD --with-qt5 --with-eigen --with-tbb
brew install cmake libyaml lz4 theora
brew install boost --with-python --c++11
brew install opencv --with-qt --with-eigen --with-tbb
brew install homebrew/science/pcl --HEAD --without-apps --without-qt #https://github.com/Homebrew/homebrew-science/issues/2593
brew install opencv3 --HEAD --with-qt5 --with-eigen --with-tbb
brew install fltk --devel
# Install the ROS infrastructure tools, you may have to run this several times until all python deps are properly installed
sudo -H pip install -U setuptools rosdep rosinstall_generator wstool rosinstall catkin_tools catkin_pkg bloom empy sphinx
# Download ROS sources
mkdir ros_catkin_ws && cd ros_catkin_ws
rosinstall_generator desktop_full --rosdistro kinetic --deps --tar > kinetic.rosinstall
wstool init -j8 src kinetic.rosinstall
# Install the necessary ROS dependencies
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro kinetic -y
# fix pcl_ros according to https://github.com/ros-perception/perception_pcl/issues/106#issuecomment-134948296
if [ -d src/perception_pcl/pcl_ros ]; then
sed -i -e 's/find_package(Eigen3 REQUIRED)/find_package(PkgConfig)\
pkg_search_module(Eigen3 REQUIRED eigen3)/g' src/perception_pcl/pcl_ros/CMakeLists.txt
fi
# fix Ogre 1.74 according to mike
# Grabbing these older meshes allows rviz to run with Ogre 1.7 rather than Ogre 1.8+. Although formulae and patches
# exist to build Ogre 1.9, rviz, and Gazebo together, I have found this approach to be the most solid and consistent.
if [ -d src/rviz ]; then
pushd src/rviz/ogre_media/models
curl https://raw.githubusercontent.com/ros-visualization/rviz/hydro-devel/ogre_media/models/rviz_cone.mesh > rviz_cone.mesh
curl https://raw.githubusercontent.com/ros-visualization/rviz/hydro-devel/ogre_media/models/rviz_cube.mesh > rviz_cube.mesh
curl https://raw.githubusercontent.com/ros-visualization/rviz/hydro-devel/ogre_media/models/rviz_cylinder.mesh > rviz_cylinder.mesh
curl https://raw.githubusercontent.com/ros-visualization/rviz/hydro-devel/ogre_media/models/rviz_sphere.mesh > rviz_sphere.mesh
popd
fi
# Build in parallel with catkin ~40 min on my computer, make sure the python version matches
sudo mkdir -p /opt/ros/jade
sudo chown $USER /opt/ros/jade
catkin config --install --install-space /opt/ros/jade
catkin build \
-DCMAKE_BUILD_TYPE=Release \
-DPYTHON_LIBRARY=/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib \
-DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7
# to work around the dyld issue https://github.com/mikepurvis/ros-install-osx/issues/12#issuecomment-149336634
# well this patch doesnt work yet but you get the idea
sed -i 's/#!/usr/bin/env bash/export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/ros/jade/lib/g' /opt/ros/jade/bin/rosrun
# Source the build ROS, prepare the workspace and from then on only source this one
source /opt/ros/jade/setup.zsh
cd ~/ros_catkin_ws
mv src src_isolated
mv devel devel_isolated
mv build build_isolated
mkdir src
catkin_make
echo 'source ~/ros_catkin_ws/devel/setup.zsh' >> ~/.zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment