你不拥有编辑shell文件时弹出的文件shell
you dont own the file shells popup when editing shells file
我正在学习本教程:
https://betterprogramming.pub/setting-up-your-mac-for-web-development-in-2020-659f5588b883
我卡在这部分了:
To update our default shell to be Homebrew’s Zsh, we need to edit the shell’s whitelist: sudo vim /etc/shells. (If you’re not comfortable with Vim, you can use TextEdit instead by running sudo open /etc/shells.)
Add a new line with /usr/local/bin/zsh, save, and close.
To change the default shell, run: chsh -s /usr/local/bin/zsh.
当我 运行 sudo 打开 /etc/shells 并尝试编辑时,它说我不拥有文件外壳并且我无法编辑文件。我是 MacOS 的新手,所以不确定我做错了什么...
sudo open ...
运行s open
作为 root,但 open
本身实际上并没有打开文件:它只是向 TextEdit 发送一个打开文件的请求,然后 运行 作为您的普通用户。
但是,您不需要编辑器来进行此更改。只需使用 tee
:
将新行附加到文件
echo "/usr/local/bin/zsh" | sudo tee -a /etc/shells
tee
将 运行 作为 root; -a
选项告诉 tee
将其输入 追加 到 /etc/shells
,而不是覆盖现有内容。
我正在学习本教程:
https://betterprogramming.pub/setting-up-your-mac-for-web-development-in-2020-659f5588b883
我卡在这部分了:
To update our default shell to be Homebrew’s Zsh, we need to edit the shell’s whitelist: sudo vim /etc/shells. (If you’re not comfortable with Vim, you can use TextEdit instead by running sudo open /etc/shells.)
Add a new line with /usr/local/bin/zsh, save, and close.
To change the default shell, run: chsh -s /usr/local/bin/zsh.
当我 运行 sudo 打开 /etc/shells 并尝试编辑时,它说我不拥有文件外壳并且我无法编辑文件。我是 MacOS 的新手,所以不确定我做错了什么...
sudo open ...
运行s open
作为 root,但 open
本身实际上并没有打开文件:它只是向 TextEdit 发送一个打开文件的请求,然后 运行 作为您的普通用户。
但是,您不需要编辑器来进行此更改。只需使用 tee
:
echo "/usr/local/bin/zsh" | sudo tee -a /etc/shells
tee
将 运行 作为 root; -a
选项告诉 tee
将其输入 追加 到 /etc/shells
,而不是覆盖现有内容。