Lok*_*lda 6 command-line osx shell fish
我正在尝试在 OSX 上使用鱼壳作为我的默认壳。我已经使用 brew 安装了鱼壳,当我想将它添加到/etc/shells
我得到这个错误:
tee: /etc/shells: No such file or directory
Run Code Online (Sandbox Code Playgroud)
这是我使用的命令行:
echo "usr/local/bin/fish" | sudo tee -a /etc/shells
Run Code Online (Sandbox Code Playgroud)
来源:https : //hackercodex.com/guide/install-fish-shell-mac-ubuntu/
我的有什么问题$PATH
吗?
slm*_*slm 10
你这样做是错的。您应该使用该chsh
命令来更改用户的 shell。
$ chsh -s /usr/local/bin/fish
Run Code Online (Sandbox Code Playgroud)
在 OSX 上,您显然必须将其添加到/etc/shells
文件中,如本题所述:OS X 拒绝将 fish 设置为默认 shell(通过 Homebrew 安装)#989。
为此,您需要运行此命令将其添加到/etc/shells
:
$ echo "/usr/local/bin/fish" | sudo tee -a /etc/shells
Run Code Online (Sandbox Code Playgroud)
之后,该文件将如下所示:
$ cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/usr/local/bin/bash
/usr/local/bin/fish
Run Code Online (Sandbox Code Playgroud)
完成上述操作后,chsh -s ...
再次尝试该命令,它应该可以工作。
这个问题似乎与如何fish
安装有关。如果您使用,brew install fish
则很可能fish
已正确添加到/etc/shells
. 如果您fish
通过其他方式安装,则很可能它没有作为条目添加到/etc/shells
文件中。
在某些情况下,/etc
本身的权限可能是问题所在。
$ ll /etc
lrwxr-xr-x@ 1 root wheel 11B Jan 26 2016 /etc -> private/etc
$ ll -d private/etc/
drwxr-xr-x 96 root wheel 3.2K Jul 12 18:53 private/etc/
Run Code Online (Sandbox Code Playgroud)
这些权限是可以接受的,如果不是,您可以像这样修改它们:
$ sudo mount -uw /
$ sudo chmod a+x private/etc
Run Code Online (Sandbox Code Playgroud)
有了上述更改,chsh -s ...
现在应该可以工作了。