ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Problem running ROS2 Foxy Demo on MacOS

asked 2021-08-21 16:36:11 -0500

nayan gravatar image


I am trying to install ROS 2 on my Mac with this tutorial:

MacOS: Big Sur 11.5.2 ROS2 Foxy Patch Release 4

When I execute:

ros2 run demo_nodes_cpp talker

I get this RCL error:

libc++abi: terminating with uncaught exception of type rclcpp::exceptions::RCLError: failed to initialize rcl init options: failed to load shared library of rmw implementation: /Users/nayanpradhan/ros2_foxy/ros2-osx/lib/librmw_fastrtps_cpp.dylib Exception: LoadLibrary error: dlopen(/Users/nayanpradhan/ros2_foxy/ros2-osx/lib/librmw_fastrtps_cpp.dylib, 1): Library not loaded: /usr/local/opt/tinyxml2/lib/libtinyxml2.8.dylib
Referenced from: /Users/nayanpradhan/ros2_foxy/ros2-osx/lib/librmw_fastrtps_cpp.dylib Reason: image not found, at /Users/osrf/jenkins-agent/workspace/ci_packaging_osx/ws/src/ros2/rcutils/src/shared_library.c:84, at /Users/osrf/jenkins-agent/workspace/ci_packaging_osx/ws/src/ros2/rmw_implementation/rmw_implementation/src/functions.cpp:64, at /Users/osrf/jenkins-agent/workspace/ci_packaging_osx/ws/src/ros2/rcl/rcl/src/rcl/init_options.c:61

In general, sourcing also gives the warning:

[connext_cmake_module] Warning: The location at which Connext was found when the workspace was built [[/Applications/rti_connext_dds-5.3.1]] does not point to a valid directory, and the NDDSHOME environment variable has not been set. Support for Connext will not be available.

How can I fix these errors/warning???


edit retag flag offensive close merge delete


Hey Nayan, did you manage to solve this problem? I have the same problem myself

victra gravatar image victra  ( 2021-10-05 04:45:48 -0500 )edit

I meet this problem too. Is there any available solution right now?

Sensenzhl gravatar image Sensenzhl  ( 2021-12-10 06:58:37 -0500 )edit

@Sensenzhl, were you able to get ROS2 working on macOS?

wgrand gravatar image wgrand  ( 2021-12-23 08:52:00 -0500 )edit

I have installed ROS2 working, but still leave this problem unsolved

Sensenzhl gravatar image Sensenzhl  ( 2022-01-01 08:26:08 -0500 )edit

My conclusion is to run Ubuntu on a USB stick and call it a day. At the time of this writing, ROS supports macOS Mojave, which was released in 2018. Now it is 2022. So, it is not worth forcing ROS to run on macOS.

wgrand gravatar image wgrand  ( 2022-01-04 13:09:43 -0500 )edit

Thanks for your reply. I've tried the method you mentioned that downgrading tinyxml2 to 2.8. The version I use now is tinyxml2 version 2.9. But it seems that tinyxml2.8 is not compatible with macOS Big Sur, it can only be used on macOS Catalina. Is there any method to deal with this?

Sensenzhl gravatar image Sensenzhl  ( 2022-01-04 18:59:21 -0500 )edit

My conclusion is that it is too tedious on macOS to ensure that all packages are the proper versions. I suggest using Ubuntu instead.

wgrand gravatar image wgrand  ( 2022-01-05 06:59:15 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2021-08-23 22:30:21 -0500

kak13 gravatar image

updated 2022-01-18 15:17:47 -0500

osilva gravatar image

did you try . ~/ros2_foxy/ros2-osx/setup.bash before you test that one?

If so, try to re-install and be sure you are on foxy

Updated (1/18/22): Answered by @chrisfromsoftware

Answer: Same problem for me as well, on macOS Mojave. I resolved my problem by following this example and downgrading my tinyxml2 to 2.8:

The git hash I used for the formula was: 1592a31d0be73d01943e729d98aab4e494ca4351

edit flag offensive delete link more


I have the same issue as @nayan. And yes, I ran . ~/ros2_foxy/ros2-osx/setup.bash. If you look carefully at the error, you see that it is trying to load tinyxml2 version 2.8, which does not install when you follow the steps specified on If you look in that directory, as of December 2021, you will see that tinyxml2 version 2.9 is installed. (I am on macOS 12.1 Monterrey.)

wgrand gravatar image wgrand  ( 2021-12-23 07:48:01 -0500 )edit

Same problem for me as well, on macOS Mojave. I resolved my problem by following this example and downgrading my tinyxml2 to 2.8:

The git hash I used for the formula was: 1592a31d0be73d01943e729d98aab4e494ca4351

chrisfromsoftware gravatar image chrisfromsoftware  ( 2021-12-23 17:02:12 -0500 )edit

I see in the ROS documentation that they are supporting macOS Mojave. But Mojave is just over 3 years old. What is the motivation to keep legacy OS?

wgrand gravatar image wgrand  ( 2021-12-25 06:41:25 -0500 )edit

Thanks @chrisfromsoftware. Downgrading tinyxml2 to 2.8 worked. Maybe you should post this as an answer!

wgrand gravatar image wgrand  ( 2021-12-28 07:25:16 -0500 )edit

@chrisfromsoftware tip did the trick for me too. Currently running on macOS Monterey 12.1 (Intel).

Karax gravatar image Karax  ( 2022-01-18 10:56:58 -0500 )edit

@Karax Can you please help with this? I have the same hardware. But i steel not understand how we need change this to downgrading tinyxml2 to 2.8. Can you please describe it in details. Thanks.

Zeitgeist gravatar image Zeitgeist  ( 2022-04-05 13:59:07 -0500 )edit

@Zeitgeist here the steps to downgrade to 2.8

cd "$(brew --repo homebrew/core)"
git checkout -b tinyxml2-2.8 1592a31d0be73d01943e729d98aab4e494ca4351
brew unlink tinyxml2
HOMEBREW_NO_AUTO_UPDATE=1 brew install tinyxml2
brew pin tinyxml2
git checkout master
git branch -d tinyxml2-2.8
brew cleanup && brew prune

märve gravatar image märve  ( 2022-04-15 11:13:34 -0500 )edit

Question Tools



Asked: 2021-08-21 16:36:11 -0500

Seen: 1,021 times

Last updated: Jan 18 '22