Reputation: 48576
Since updating Watchman recently (with Homebrew) I can no longer use it to watch projects. I get
{
"version": "2022.05.30.00",
"error": "std::__1::system_error: open: /Users/Path/To/Project: Operation not permitted"
}
I initially assumed that this must simply be file access issue I could resolve in the normal way, but giving the watchman app access to Files & Folders does not resolve the issue (even with termination of all watchman processes and restart of Terminal).
For good measure, I also manually added the watchman executable to Full Disk Access (something I've never needed to do before and am not comfortable with) but this also had no effect.
I have also terminated every relevant process I can think of, and even rebooted, twice. As far as I know the only change since Watchman worked was my running brew update watchman
(which I have of course also uninstalled and reinstalled).
One concern is that for some reason I have multiple entries for watchmen in System Preferences, which weirdly results in it taking several dozen attempts to whack-a-mole all of them into a checked state for access:
How do I give Watchman the permissions needs to overcome this error?
Upvotes: 46
Views: 44737
Reputation: 1730
The clean solution is to kill the server and restart the metro builder:
Kill watchman server:
watchman shutdown-server
Restart metro:
yarn start --reset-cache
Upvotes: 2
Reputation: 328
In my case, I am on the MacOS beta, which means the standard XCode does not work. In order to resolve this, I had to delete the XCode app and rename the XCode-beta
to XCode
.
Upvotes: 0
Reputation: 88
Just got this error earlier (Air M2), I don't know I just updated my OpenJDK and this happended, this is my solution.
Upvotes: 2
Reputation: 21
As mentioned previously, you need to 'Accept' perms for watchman again. I use yarn and needed to run 'npm start' to show dialog again.
Upvotes: 2
Reputation: 9935
We can also encounter this error message when running React Native apps. To resolve the error, we need to re-request permissions for the watchman
tool which RN uses.
Navigate to the project root folder and run npm start
in a Terminal. This should request permissions for watchman
and once granted, we can build the app again.
The typical build process outside a terminal doesn't re-request permissions which is why we need to start from a Terminal separately.
Upvotes: 1
Reputation: 588
If the server and client versions don't match up, you should probably restart your server: watchman shutdown-server ; watchman
https://facebook.github.io/watchman/docs/cmd/version.html
Upvotes: 49
Reputation: 81
It seems that the problem is that the watchman didn't have permission to access the ~/Documents folder. 🤔 Reinstalling watchmen seems to work as it triggers the grant access prompt.
Upvotes: 0
Reputation: 2818
On my M1 Mac:
My issue was that watchman didn't have permissions to ~/Documents
folder. I don't know if this was the case before or after reinstalled it. Here are the steps I took:
brew uninstall watchman
brew install watchman
watchman shutdown-server (just in case it's running)
watchman watch-del-all
yarn start --reset-cache
When I tried to launch metro, MacOS prompted me to give permissions. After accepting, the bundler ran without issue.
Upvotes: 97
Reputation: 10209
It looks like watchman: stable 2022.08.15.00
is working fine on my Mac M1. Upon start, you need to grant access to the local folders about to be synched.
I also had the problem, like many others.
I reverted to a "working" version, e.g. 2022.05.16.00
There are multiple ways to do so; one (without private taps) would be:
# -- 1 -- uninstall
brew uninstall watchman
# -- 2 -- replace formula
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/8651d8e23d308e564414188509f864e40548f514/Formula/watchman.rb > /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/watchman.rb
# -- 3 -- install again, using replaced formula
brew install watchman
# -- 4 -- pin that version - Don't forget to unpin once this problem is solved...
brew pin watchman
# -- 5 -- reset formula to original
cd /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/
git checkout -- watchman.rb
Then shutdown any lingering instances of Watchman with
watchman shutdown-server
Remark: On Intel-Macs, homebrews repository is located at a different place. You can find out by calling brew --repository
.
Typically, the Formula is expected in directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
Once the problems with watchman are solved, you can unpin watchman again and use the normal brew update/upgrade machanism.
Upvotes: 23