问题描述
我的 Macbook Pro 上有两个用户运行 macOD Mojave 10.14.2 - 一个用于工作,一个用于个人.
I have two users on my Macbook Pro running macOD Mojave 10.14.2 - one for work and one for personal.
我在安装 react native cli 的两个用户上都设置了 React Native &守望者
I set up React Native on both users installing the react native cli & watchman
brew install watchman
sudo npm install -g react-native-cli
这行得通,我能够使用 npm start
This worked and I was able to run the local server with npm start
我尝试对其他用户执行相同操作,但由于权限问题无法使用自制软件安装 watchman.
I tried doing the same on the other user but was not able to install watchman with homebrew due to permissions issues.
我运行了以下
sudo chown -R $(whoami):admin $(brew --prefix)/*
然后就解决了.我再次能够运行本地开发服务器.
And that fixed it. I was once again able to run the local dev server.
除了现在当我回到我的另一个用户时,我无法再次运行服务器.
Except now when I went back to my other user, I was not able to run the server again.
运行 npm start
正在加载依赖关系图...libc++abi.dylib:以 std::__1::system_error 类型的未捕获异常终止:打开:/usr/local/var/run/watchman/yev-state:权限被拒绝
Watchman:watchman --no-pretty get-sockname 返回,退出代码=null,signal=SIGABRT,stderr= libc++abi.dylib:以未捕获的 std::__1::system_error 类型异常终止: 打开:/usr/local/var/run/watchman/yev-state: 权限被拒绝
我再次尝试运行 sudo chown -R $(whoami):admin $(brew --prefix)/*
这次没有修复它.
I tried running sudo chown -R $(whoami):admin $(brew --prefix)/*
again which didnt fix it this time.
我还查找了如何为多用户 Mac 配置 Homebrew 并发现 这篇短文
I also looked up how to configure Homebrew for multi-users macs and found this short article
我创建了一个名为brew"的用户组,将我的工作用户和个人用户添加到其中并运行以下命令:
I created a user group called "brew", added both my work and personal users to it and ran the following:
sudo chgrp -R brew $(brew --prefix)/*
sudo chmod -R g+w $(brew --prefix)/*
仍然没有骰子.
我无法在两个用户上自由使用自制软件或运行开发服务器(由于守望者权限错误)的地方获得它.每次更改用户时,我都必须修复"权限问题.
I am not able to get it where I can freely user homebrew or run the dev server (due to watchman permissions error) on both users. I have to "fix" the permissions issue every time I change users.
推荐答案
/usr/local/var/run/watchman
目录需要有权限 2777
以便任何用户都可以在其中创建自己的状态目录:
The /usr/local/var/run/watchman
directory needs to have permissions 2777
so that any user can create their own state directory inside:
sudo chmod 2777 /usr/local/var/run/watchman
此外,watchman 会执行一些健全性检查,以查看 state 目录是否可能具有妥协的权限;我怀疑您非常广泛的递归 chmod
和 chown
调用正在触发它,所以我建议这是一个非常安全的事情,尽管假设其他用户有一个破坏性的事情工作守望者:
In addition, watchman performs some sanity checks to see if the state directory looks like it might have compromising permissions; I suspect that your very broad recursive chmod
and chown
calls are triggering that, so I'd recommend this as a very safe albeit disruptive thing to do assuming that other users have a working watchman:
sudo rm -rf /usr/local/var/run/watchman/*
这篇关于多用户 Mac 上 Watchman 的 Homebrew 权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!