watchman

Can't use Watchman: "Operation not permitted"


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:

enter image description here

How do I give Watchman the permissions needs to overcome this error?


Solution

  • Update Aug-19-2022

    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.


    Original

    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 watchman
    2. Downgrade the watchman.rb formula to an older version
    3. Install watchman according to that version
    4. Pin it (to prevent further watchman updates)
    5. Finally reset the watchman.rb formula to the original state again
    # -- 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.