Skip to content

Instantly share code, notes, and snippets.

@atinfinity
Last active March 20, 2024 02:26
Show Gist options
  • Save atinfinity/c267606783555c83fd43fbe8842a3603 to your computer and use it in GitHub Desktop.
Save atinfinity/c267606783555c83fd43fbe8842a3603 to your computer and use it in GitHub Desktop.
ROS 2 Humble installation for macOS

Disable System Integrity Protection(SIP)

You need to disable System Integrity Protection(SIP).
https://docs.ros.org/en/humble/Installation/Alternatives/macOS-Development-Setup.html#disable-system-integrity-protection-sip

Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> $HOME/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Dependency packages

brew install \
    asio assimp bison bullet cmake console_bridge cppcheck \
    cunit eigen freetype graphviz opencv openssl orocos-kdl pcre poco \
    qt@5 sip spdlog tinyxml tinyxml2 wget tcl-tk
brew uninstall --ignore-dependencies python@3.12 qt6

pyenv

brew install pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> $HOME/.zshrc
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> $HOME/.zshrc
echo 'eval "$(pyenv init -)"' >> $HOME/.zshrc
pyenv install 3.11.8
pyenv global 3.11.8
pyenv local 3.11.8
source $HOME/.zshrc

Python package

python3.11 -m pip install -U pip
python3.11 -m pip install --config-settings="--global-option=build_ext" \
       --config-settings="--global-option="-I$(brew --prefix graphviz)/include/"" \
       --config-settings="--global-option="-L$(brew --prefix graphviz)/lib/"" \
       pygraphviz
python3.11 -m pip install -U \
      argcomplete catkin_pkg colcon-common-extensions coverage \
      cryptography empy==3.3.4 flake8 flake8-blind-except==0.1.1 flake8-builtins \
      flake8-class-newline flake8-comprehensions flake8-deprecated \
      flake8-docstrings flake8-import-order flake8-quotes \
      importlib-metadata lark==1.1.1 lxml matplotlib mock mypy==0.931 netifaces \
      nose pep8 psutil pydocstyle pydot pyparsing==2.4.7 \
      pytest-mock rosdep rosdistro setuptools vcstool pycairo PyQt5

source $HOME/.zshrc

ros2_m1_native

git clone https://github.com/TakanoTaiga/ros2_m1_native.git
cd ros2_m1_native
mkdir src
vcs import src < ros2.repos
patch -l < patches/ros2_console_bridge_vendor.patch
patch -l < patches/ros2_rviz_ogre_vendor.patch
patch -l < patches/ros_visualization_rqt_bag.patch
export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$(brew --prefix qt@5)
export PATH=$PATH:$(brew --prefix qt@5)/bin
export COLCON_EXTENSION_BLOCKLIST=colcon_core.event_handler.desktop_notification
python3.11 -m colcon build --symlink-install --packages-skip-by-dep qt_gui_cpp --packages-skip qt_gui_cpp --cmake-args \
            -DBUILD_TESTING=OFF \
            -DTHIRDPARTY=FORCE \
            -DCMAKE_BUILD_TYPE=Release \
            -Wno-dev
source ~/ros2_m1_native/install/setup.zsh
export ROS_VERSION=2
export ROS_PYTHON_VERSION=3
export ROS_DISTRO=humble
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment