Watchman: Why does watchman run under "sudo" on macOS sierra?

Created on 15 Oct 2016  路  5Comments  路  Source: facebook/watchman

I am an user of mac, recently upgraded my mac to macOS sierra? Because I am a newcomer of Ember.js, I installed Homebrew to append extra tools into mac, Watchman is one of them(brew install watchman, without sudo).

The whole installation is successful, but I found a wired situation while I was running commands such as "watchman version". It was stuck, no any response completely. But if I run it under sudo, everything is fine.

Because of this situation, ember-cli doesn't work well. I must run "sudo ember new xxx" to create a new project, however the permission of generated files belong to "root", not me. I know I can use "chown" to change the ownership, but I think something is wrong.

Could you guys help me out? Thanks.

(Watchman 4.7 is my currently being used version.)

Most helpful comment

You should not use sudo to interact with watchman.

It's not clear what state your system is in now. Here are some commands that you can try to run to speculatively get things into a reasonable state:

sudo launchctl unload -F ~root/Library/LaunchAgents/com.github.facebook.watchman.plist
launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist

After running those commands, please share the output from:

ps -ef | grep watchman

And if there are no watchman processes still running, try:

watchman version

If that doesn't work, please collect your logs (https://facebook.github.io/watchman/docs/troubleshooting.html#where-are-the-logs has information on where to find them) and share them here.

All 5 comments

You should not use sudo to interact with watchman.

It's not clear what state your system is in now. Here are some commands that you can try to run to speculatively get things into a reasonable state:

sudo launchctl unload -F ~root/Library/LaunchAgents/com.github.facebook.watchman.plist
launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist

After running those commands, please share the output from:

ps -ef | grep watchman

And if there are no watchman processes still running, try:

watchman version

If that doesn't work, please collect your logs (https://facebook.github.io/watchman/docs/troubleshooting.html#where-are-the-logs has information on where to find them) and share them here.

@wez thanks, this solve the problem :)

Thanks, @wez

I had tried your advices, one of commands
sudo launchctl unload -F ~root/Library/LaunchAgents/com.github.facebook.watchman.plist doesn't work, then the mac told me that
/private/var/root/Library/LaunchAgents/com.github.facebook.watchman.plist: Could not find specified service. But the 2nd command launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist works. Nothing echoes on screen.

Immediately, I run watchman version for first time and got outputs on screen as fellow:
/Users/jyang/Library/LaunchAgents/com.github.facebook.watchman.plist: Could not find specified service { "version": "4.7.0" }. The second time, I got a normal output { "version": "4.7.0" }, without the error log.

Now ember new xxx's turn, after changing permission of ~/.config/configstore/bower-github.json from root to me via chown, I've eventually got a perfect ember project.

PS. The permission issue might be my fault, because I remember using sudo ember new xxx before this post.

Thanks, @wez, again.

(By the way, could you tell me what was going on?)

Had the same issue with react-native after a brew update. It took me few hours to come to this thread and fix it in a seconds, because react-native wasn't showing any debug feedback.

Had the same problem, by installing watchman with brew and this command fixed it.

Was this page helpful?
0 / 5 - 0 ratings