Shail Patel
Shail Patel

Reputation: 1814

the command `brew install watchman` runs `chmod` but fails to install eventually

brew install --HEAD watchman
==> Cloning https://github.com/facebook/watchman.git
Updating /Library/Caches/Homebrew/watchman--git
==> Checking out branch master
==> ./autogen.sh
==> ./configure --prefix=/usr/local/Cellar/watchman/HEAD --with-pcre
==> make
==> make install
install: chmod 777 /: Operation not permitted
touch //.not-empty
touch: //.not-empty: Permission denied
make[1]: *** [install-exec-local] Error 1
make: *** [install-am] Error 2
couldn't understand kern.osversion `14.5.0'

READ THIS: https://git.io/brew-troubleshooting

It is trying to chmod 777 / which is not good. Why is it trying to do that? Feels like that shouldn't be allowed. I tried to uninstall watchman and reinstall with this command to get a react-native to start working.

Followed steps here: https://github.com/facebook/react-native/issues/239

https://facebook.github.io/react-native/docs/troubleshooting.html

Upvotes: 3

Views: 49465

Answers (8)

Prajval Singh
Prajval Singh

Reputation: 1141

For me, running the following command worked:

brew install --HEAD watchman

For more information do consult the official documentation Watchman documentation from Facebook

Screenshot from Watchman documentation

Upvotes: 0

varun dhiman
varun dhiman

Reputation: 23

People on new M1, M2 macbooks use arch -x86_64 brew install <package>

Upvotes: 1

Maroua El Baoui
Maroua El Baoui

Reputation: 31

For me worked the same as above:

brew update
brew doctor
brew install watchman

Also make sure you have this in the jest config:

watchPathIgnorePatterns: ['node_modules']

Upvotes: 0

Izaak
Izaak

Reputation: 13

Try

brew update
brew doctor
brew install watchman

If you are still having problems, try going to your_project/node_modules/react-native/packager/react-packager/src/FileWatcher/index.js and increase the MAX_WAIT_TIME

Upvotes: 0

mihai
mihai

Reputation: 4214

Fix for installing on OSX high sierra 10.13.2 required reinstalling homebrew since it needs to work around the non-writeable /usr/local/ folder

I had to reinstall homebrew:

uninstall:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" reinstall:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Upvotes: 1

MTZ4
MTZ4

Reputation: 2346

brew uninstall watchman
sudo chown -R `whoami` /usr/local
brew link pcre
brew install watchman

Upvotes: 18

Wez Furlong
Wez Furlong

Reputation: 4987

Sorry about this, should be fixed now in https://github.com/facebook/watchman/commit/b35c6ed36a5f60ab3f214ddc646a8a03e03a0fee

Upvotes: 3

James Lelyveld
James Lelyveld

Reputation: 294

Ok fixed it

You can install watchman without the --HEAD option (the currently tracked version of watchman is old enough to not have the issue specified). So just do a brew install watchman.

If you then get issues with your react project make sure that your project directory is a git repo (run git init if not) see:

https://github.com/facebook/react-native/issues/2032

https://github.com/facebook/react-native/issues/2042

Upvotes: 3

Related Questions