Closed leoasis closed 1 year ago
Specifically, in main.cpp where the launchctl plist is generated: https://github.com/facebook/watchman/blob/827332086f7bb13b63bf7456527bf443c233d019/watchman/main.cpp#L543-L549
Currently it passes through the PATH env var. Additionally, it could pass through the DYLD_LIBRARY_PATH if present.
Instead of relying on DYLD_LIBRARY_PATH
, consider passing
-DCMAKE_INSTALL_RPATH=/path/to/your/lib
or
-DCMAKE_INSTALL_NAME_DIR=/path/to/your/lib
to your CMake invocation when building Watchman from source instead.
DYLD_LIBRARY_PATH
is definitely not something you want to rely on: Apple clears it from the environment when running executables protected by SIP, and it could cause processes spawned by watchman to misbehave. If you really must use an environment variable, try DYLD_FALLBACK_LIBRARY_PATH
instead.
Thanks for commenting - @leoasis I think we can close this issue.
Hi!
We want to use watchman in an environment that prefers to keep commands and its resources colocated in their folders, which led us to have to execute watchman with a wrapper script that uses
DYLD_LIBRARY_PATH
with the value set to the path where the/lib
folder is located.This works great whenever we run the command with
--no-site-spawner
, but when using launchctl we see that the plist that's generated doesn't pass that environment variable through so the server cannot start properly as it can't find the library files.Would it be possible to consider writing this variable in the plist file whenever it's set?