Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A step by step installation of ROS Lunar on macOS Sierra.
# The commands below resulted in successful compilation and installation
# of ROS Lunar on macOS Sierra
# desktop distribution is used instead of desktop_full to avoid installation
# of Gazebo7 and Qt4. Gazebo8 works out of the box when installed from brew.
#
# Note: Commands presented in this file are intended to be executed manually,
# one by one, as opposed to running this file as a script. Some paths used
# here should be adapted to your environment.
# Create a workspace
mkdir -p ~/Development/ros_catkin_ws_lunar
cd ~/Development/ros_catkin_ws_lunar
brew update
# Taps
brew tap ros/deps
brew tap osrf/simulation
brew tap homebrew/science
# Manual installation of necessary dependencies,
# as they are missing in rosdep list
brew install python cmake qt5 webp libpng
brew install pyqt5 --with-python
# Because of a recent change in homebrew python formula,
# brewed python no longer overshadows the system python.
# Linking it manually helps
ln -s /usr/local/opt/python/libexec/bin/python /usr/local/bin/python
# Qt naming fix
ln -s /usr/local/share/sip/Qt5 /usr/local/share/sip/PyQt5
# XCode Command Line Tools (needed for fast installation of bottled GCC)
xcode-select --install
# From ROS turorial
pip install --upgrade pip setuptools
pip install -U wstool setuptools rosdep rosinstall rosinstall_generator rospkg catkin-pkg Distribute sphinx
sudo -H rosdep init
rosdep update
# Download ROS packages
rosinstall_generator desktop_full --rosdistro lunar --deps --wet-only --tar > lunar-desktop-full-wet.rosinstall
wstool init -j8 src lunar-desktop-full-wet.rosinstall
# Get dependencies
# Skips dependencies which were installed manually
rosdep install --from-paths src --ignore-src --rosdistro lunar -y --skip-keys="libqt5-core libqt5-gui libqt5-opengl libqt5-opengl-dev libqt5-widgets qt5-qmake qtbase5-dev python-qt5-bindings-webkit python-qt5-bindings python-qt5-bindings-gl libwebp-dev libpng-dev gazebo7 libgazebo7-dev libogre-dev"
# Compile and install
# Additional flags fix problems with Qt and Python linking
# It uses python installed with brew instead of stock one
./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/usr/local/opt/qt;/Users/lubiluk/Development/ros_catkin_ws_lunar/install_isolated" -DCMAKE_FIND_FRAMEWORK=LAST -DPYTHON_INCLUDE_DIR="/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Headers" -DPYTHON_LIBRARY="/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib" -DCMAKE_MACOSX_RPATH=ON -DCMAKE_INSTALL_RPATH="/Users/lubiluk/Development/ros_catkin_ws_lunar/install_isolated/lib"
@Tobias-Fischer
Copy link

Tobias-Fischer commented Feb 19, 2021

There is now an easy way of installing ROS on OSX using conda: conda install ros-noetic-desktop -c robostack. More info on https://medium.com/robostack/cross-platform-conda-packages-for-ros-fa1974fd1de3 and https://github.com/RoboStack/ros-noetic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment