watchman: Watchman fails with 'Operation not permitted'
Since updating yesterday using Hombrew on macOS, watchman always fails with the error:
{
"version": "2022.05.30.00",
"error": "std::__1::system_error: open: /Path/To/Project: Operation not permitted"
}
Does the 2022.05.30.00 version of Watchman work? if so, why would it fail (for me at least) suddenly after being updated?
As far as I know the only difference between the configurations of my machine today and yesterday (when Watchman worked fine) is that I ran brew upgrade watchman
. I have confirmed all the necessary file permissions are in place and have rebooted, reinstalled, terminated, etc.
UPDATE: A solution to get things working while we await a fix to Watchman is provided below:
watchman shutdown-server # To ensure an old version isn't still running
brew uninstall watchman # Get rid of the buggy (e.g., 2022.05.30.00) version
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/8651d8e23d308e564414188509f864e40548f514/Formula/watchman.rb > "$(brew --repository)/Library/Taps/homebrew/homebrew-core/Formula/watchman.rb"
brew install watchman # This installs the functioning 2022.05.16.00 version dowloaded above
brew pin watchman # Tell brew to leave this older version alone (don't forget to unpin once this problem is solved)
cd "$(brew --repository)/Library/Taps/homebrew/homebrew-core/Formula/"
git checkout -- watchman.rb # To avoid brew showing warnings about having uncommitted git changes
Note that for those who have found other solutions, you are not experiencing the same issue, but of you are doing things like granting watchman full disk access, you may be reducing your security unnecesarily.
Also, if you are on macOS, and the above doesn’t work on its own, it may pay off to do the following and try the above again:
sudo tccutil reset SystemPolicyDocumentsFolder
sudo tccutil reset SystemPolicyAllFiles
If you do this, you will need to again grant access to those apps that need it (they will ask).
UPDATE:As of 2022.06.27.00 Watchman appears to work again.
If you followed the instructions above, just
brew unpin watchman
and update it as usual. Then (and from then on), to be sure things work as expected, after every update of Watchman:
watchman watch-del-all
watchman shutdown-server
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 35
- Comments: 90 (2 by maintainers)
This is definetly a problem with version 2022.05.30.00. If you rollback to 2022.05.16.00, it works again. Howto: See https://remarkablemark.org/blog/2017/02/03/install-brew-package-version/
TLDR:
Version
2022.06.20.00
did not have the fix in it, but from what I can tell2022.06.27.00
does.I had to make sure I didn’t have an older watcher still around (
watchman shutdown-server
) but after doing so, the first post-upgrade watchman I triggered asked for access to files in the Documents folder - and once allowed, worked fine without any “Operation not permitted” errors occuring.Seems that the following does the trick:
watchman shutdown-server
watchman
.YES
Finally got this to work. I’m on an Intel iMac running Monterey. Here were my steps:
This did nothing initially, but then I ran:
sudo npm run test
as discussed here.A permission window then popped up where I was finally able to give access to my Desktop (project is living on my Desktop).
I then rebooted the terminal - didn’t need to restart macOS (although it couldn’t hurt). I also didn’t touch anything in “Security & Privacy” under System Preferences like some have mentioned.
I ran
npm run start
and it worked, finally. My god, that was a fun 8 hours.@shoopi12 I recommend giving it a shot. The instructions above work. The only things to be careful of are:
cd
to that directory before thegit checkout
step.watchman shutdown-server
afterwards to make sure an older version isn’t lingering around.This works, however in my case I accidentally hit “Don’t Allow” and wasn’t able to trigger that prompt again. I have Mac OS Monterey. In order to allow access, go to Preferences > Security & Privacy > Privacy > Files and Folders and add tick next to Watchman > Documents Folder
MacOs Monterey 12.4 Still got this problem. Watchman 2022.06.06.00. Pls help.
This fix will work. Kindly try it
Install latest watchman version (brew install watchman)
Make sure ur project folder is under /Users/<username>/<project>. Don’t put it under documents or any other folder there. It will refuse due to some weird restrictions.
On mac the issue for me was that I didnt approve permissions for folder to watchman. So System preferences -> Security & Privacy -> Privacy -> Files and Folders -> Watchman -> Desktop Folder.
I was able to work around this by using
brew install --HEAD watchman
I have just installed 2022.06.06.00 and the same problem still persists. Currently I am trying to get it to work using one of the solutions above.
In an attempt to fix this I’ve run
then rebooted and run
That results in a series of library errors that are cleared by reinstalling several of watchman’s dependencies. Once that’s done I did
then rebooted again and did
and still get the same error:
I then gave watchman Full Disk Access, but continue to see the same error.
Also at no point during this process does launching watchman result in the expected request for access to the Documents folder (as all other apps that need it do correctly following the
tccutil reset
s).Backout in https://github.com/facebook/watchman/commit/cf0c3bdec32f2f457a0b06fcd1c09a62c11cf143
We don’t maintain the homebrew build, but hopefully a new one comes out soon.
Confirming that this is also the only thing that works for me.
Not a practical solution, but it will allow some headway to be made.
Hope that’s true! Waiting for confirmation from others.
It would be nice if a contributor could confirm and close.
I’m still getting a
Operation not permitted
on version2022.06.27.00
. My Mac run out of space and I can not locate React Native project inside home folder. watchman sucks.@orome sorry I omitted it from my Comment, I did the step of course
Edit: After restarting my computer it worked. I’m summing up the steps here once again for anyone else:
If needed, give watchman Files and Folders / Full Disk Access permission, maybe uncheck and recheck it. When I tried
npm start
again I got the blessed alert “watchman would like to access your Files and Folders”. After confirming everything worked.@orome tried that, but for some reason I still get the error with the higher version:
while watchman -v shows the lower version:
What I did:
@oetjen I get:
I don’t even have an
/opt/homebrew/
, just an/opt/homebrew-cask/
, which is empty.I do have a
which contains a
caskroom
and ahomebrew
. Should I be usinginstead?
Yes, this bug kills
expo start
: no development is happening here.The only thing that seems to work is moving your entire project to your Home folder. Nothing else seems to work. It seems to be affecting a lot of other users right now, likely a bug with some new macos security update with file access permissions.
I have the same error after following the React Native getting started guide, on both xcode and expo cli.
I hope the watchman team looks into this!
That solution is exactly describing what has already been posted right here in this thread in June 2022, please don’t repeat: https://github.com/facebook/watchman/issues/1030#issuecomment-1145766948
macos 13.1 just fxuck me!
here is my solution:
Click on the Apple Icon and open System preferences -> Click on Security & Privacy -> File & Folders -> check Watchman
Sorry! Yes - 06.27 was the version I updated to that resolved this issue for me after uninstalling watchman 06.20. I also did the suggested check and ran the shutdown server command and to my surprise even after uninstalling watchman, 06.20 was still running on my machine. My workspace is a MacBook Pro M1 running Monterey 12.0.1.
2022.06.27.00
indeed does fix the issue for the repo on the external drive on my system (Apple Silicon/macOS 12.4).I’m still getting a
Operation not permitted
on version2022.06.20.00
. My app is on an External HDD.Update: It does work if I move the files to my local HDD.
I’ve done the above solution to revert to a working version, but it seems incompatible with another tool, folly which is at a later version. Any fix there? @robert-go seemed to be having the same issue above.
Downgrade to Version 2022.05.16 work for me. (Mac OS Monterey 12.4 - Intel Chip)
watchman watch-del-all
watchman shutdown-server
brew unpin watchman
brew uninstall watchman
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/8651d8e23d308e564414188509f864e40548f514/Formula/watchman.rb > /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/watchman.rb
brew install watchman
brew pin watchman
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/
git checkout -- watchman.rb
And restart your mac. and run
watchman version
It is should be2022.05.16.00
If you still get error … run metro at least twice times and check watchman version that showed in Error Log. I hope this help.
I hope watchman team will fix this soon.
@musasoftlabx Thanks for the explaination.
I’m running on Intel, with Monterrey.
I think thoses permissions does affect my projects setup not only reactnative. I have been experiencing problems with sockets on mariadb since I upgraded macos, brew.
/bin/sh
The workaround worked around initially but it’s broken again and now I’m getting different error.
And I also get this error trying to run any watchman command directly:
And I did run
brew upgrade
multiple times since the workaround steps. Maybe we need pin more than just watchman itself.It is to reset the change you just made by replacing watchman.rb with a previous version. Brew update will break if you have un-committed changes.
I tried that both using the ZIP (which doesn’t work at all #1031) and using previous Hombrew formulas, none of which produced a functioning installation. How did you manage to install a previous version?