New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$PATH is very hard to set on MacOS Yosemite #68
Comments
this a regression from switching to launchd (watchman is supposed to capture your PATH at the time you launch it). A workaround would be to edit
(see then:
I'll work up a fix sometime in the coming week. |
That's a little less palatable than my solution TBH, because it doesn't update as I update .profile, and as I've just updated to Yosemite and am having to reinstall my toolchain $PATH is a bit of a moving target ;-) Thanks for the attention, I'll look forward to a pukka fix. |
I just ran into this issue. All of the homebrew tools are unavailable by default. @wez's solution works. I did the following for PATH
|
Any updates on this? As a hack I've added a script to freeze my current env into the plist: #Freeze the current env to the watchman config. This is a hack to get around
# https://github.com/facebook/watchman/issues/68
ENVIRONMENT=$(env | sed 's/=/<\/key><string>/' | sed -e 's/^/<key>/' | sed -e 's/$/<\/string>/')
echo $ENVIRONMENT
PLIST=~/Library/LaunchAgents/com.github.facebook.watchman.plist
# Remove the last two lines.
sed -i '' -e '$ d' $PLIST
sed -i '' -e '$ d' $PLIST
# replace the second to last line (previously "</dict>") with our environment +
# "</dict>"
echo "<key>EnvironmentVariables</key><dict>"$ENVIRONMENT"</dict></dict>" >> $PLIST
# Replace the last line
echo "</plist>" >> $PLIST
# Reload the watchman config
launchctl unload -w ~/Library/LaunchAgents/com.github.facebook.watchman.plist
launchctl load -w ~/Library/LaunchAgents/com.github.facebook.watchman.plist but it's annoying to manually run that after any update to my env. |
We have a diff that we'll land real soon now: https://reviews.facebook.net/D36045 |
Summary: Prior to switching to launchd, the daemonization would capture your PATH at the time that we spawned the service. Launchd will start our service with a default environment, so this diff captures the PATH in a similar fashion. There may be other important env vars that we should do this for; I'm hoping that PATH is good enough. We use CDATA to avoid having to pull in "proper" XML escaping just for the plist file. Addresses #68 Test Plan: manually: ``` ./configure --enable-statedir=/tmp make ./watchman version less ~/Library/LaunchAgents/com.github.facebook.watchman.plist ``` Reviewers: sid0 Reviewed By: sid0 Differential Revision: https://reviews.facebook.net/D36045
This has landed; we're going to cut 3.1 with this fix in it soon and submit a PR to homebrew. |
I am still having an issue related to this (I think) using 3.3.0. I ran the following in my project root:
But when I check the logs, I see a "No such file or directory" error. If I change the command to |
I think you want this:
otherwise watchman will try to find the file named "browserify -o bundle.js" in your path and execute it |
I tried that as well...no luck. I also tried it with various node-related commands and they all fail with the same error. Any other ideas? In the log file, I can see that the path is correct but it just doesn't seem to want to execute any command related to node. |
I can't see your log file so I don't have any more context than you have shared on this closed issue.
|
I'll give that a shot. Thanks for your help! |
For anybody looking - my hack to freeze the environment into the plist doesn't work so well anymore, but I wrote a new script to bake the current environment into a shell script:
When I want to run something with watchman I pass the target to run to that script, and then pass the output to watchman. |
Commands that I invoke through Watchman on Yosemite have a PATH set to /usr/bin:/bin:/usr/sbin:/sbin
Needless to say, very little of my toolchain is in that path.
I think that it has to do with launchd defaulting to a very restricted path http://apple.stackexchange.com/questions/106355/
The only solution I've come up with is to source ~/.bash_profile in scripts invoked from Watchman, but this means that if I invoke them normally they have an enormous path set.
The text was updated successfully, but these errors were encountered: