Skip to content

Add missing "Contents" directory suffix for webots MacOS installations #30

Open
hoeftjch wants to merge 1 commit into
BlueAndi:developfrom
hoeftjch:dev/macos_support
Open

Add missing "Contents" directory suffix for webots MacOS installations #30
hoeftjch wants to merge 1 commit into
BlueAndi:developfrom
hoeftjch:dev/macos_support

Conversation

@hoeftjch

@hoeftjch hoeftjch commented Jun 7, 2026

Copy link
Copy Markdown

On macOS, Webots is installed as a .app bundle. The conventional WEBOTS_HOME points to the bundle root (e.g. /Applications/Webots.app), but all headers, sources, and libraries reside one level deeper under Contents/. The scripts and library.json assumed a flat layout, causing FileNotFoundError on macOS.

Changes

  • scripts/create_webots_library.py: detect macOS and prepend /Contents to all paths derived from WEBOTS_HOME
  • scripts/copy_webots_shared_libs.py: same fix for the dylib paths in SHARED_FILES_LIST
  • library.json: fix -L flag from lib/Webots/lib/controller to lib/Webots/lib (the actual directory create_webots_library.py copies the dylib into)

Note: The webots-controller executable will also expect WEBOTS_HOME to simply point to the *.app file and would fails with the following error when adding "Contents/" to the WEBOTS_HOME variable and would fail with this error:

dyld[5780]: Library not loaded: @rpath/Contents/lib/controller/libController.dylib
  Referenced from: <2029B01F-9D80-3E00-90C0-C23650F528D8> /Users/jhoeft/projects/RadonUlzer/.pio/build/LineFollowerSim/program
  Reason: tried: '/Applications/Webots.app/Contents/Contents/lib/controller/libController.dylib' (no such file), '(null)/libController.dylib' (no such file)

@BlueAndi BlueAndi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation of Webots mention this here, so I think the fix is ok:
https://cyberbotics.com/doc/guide/compiling-controllers-in-a-terminal?version=master

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants