Published on

How to fix React Native Watchman error Operation not permitted.

Authors

How to fix Watchman system_error: 'Operation not permitted' on macOS with M1 MacBook

You want to run and test a React Native (RN) app on an iOS emulator? But what if the emulator shows the error "No bundle URL present. Make sure you are running a packager server or hava include a .jsbundle file in your application"? What can you do to solve the problem? How to fix „No bundle URL present.“ on the iOS emulator on MacOS 12.6 running on a M1 MacBook Pro?

iOS emulator

Do you receive the error message "No bundle URL present" on the iOS emulator after starting the app with

npx react-native run-ios

Please check if you have the following error message on the terminal console:

Error: Watchman error: std::__1::system_error: pen: /Users/path-to-your-project: Operation not permitted. Make sure watchman is running for this project.

watchmanResponse: {
    error: 'std::__1::system_error: open: /Users/ridvan/Documents/source/visualstudioworkplace/SmartChecklists: Operation not permitted',
    version: '2022.06.13.00'
  }

What can you do to solve this problem?

Install the working version of watchman.

On a Apple MacBook with M1 and running MacOS Monterey (12.6) the version 2022.05.16.00 of watchman is working. Follow the steps below to uninstall the newer version of watchman and install watchman 2022.05.16.00.

Check the version of watchman (I had 2022.10.10.00)

watchman -v

Uninstall the newer version of watchman

brew uninstall watchman

Change Homebrew package defition (Formula) to install a older version

curl https://raw.githubusercontent.com/Homebrew/homebrew-core/8651d8e23d308e564414188509f864e40548f514/Formula/watchman.rb > /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/watchman.rb

Now install the older version of watchman with the replaced Homebrew formula

brew install watchman

If you get the error "Error: watchman 2022.10.10.00 is already installed", then unlink watchman and install the older version

brew unlink watchman && brew install watchman

Do not forget to reset the Homebrew formula to original

cd /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/ && git checkout -- watchman.rb

Shutdown watchman

watchman shutdown-server

Now start your app again with

npx react-native run-ios

Your React Native iOS app should now run on the emulator.