我不喜欢每次启动终端时都重新输入鱼。我希望Fish默认开启。如何将Fish shell设置为Mac上的默认shell ?
当前回答
如何在现代macOS上获得最新版本的Bash(在macOS v10.14 (Mojave)上测试)。
brew install bash
which bash | sudo tee -a /etc/shells
chsh -s $(which bash)
然后你就可以得到vim风格的tab补全了,它只在Bash >= 4上可用(Homebrew的当前版本是5.0.2):
# If there are multiple matches for completion, Tab should cycle through them
bind 'TAB':menu-complete
# Display a list of the matching files
bind "set show-all-if-ambiguous on"
# Perform partial completion on the first Tab press,
# only start cycling full results on the second Tab press
bind "set menu-complete-display-prefix on"
其他回答
M1 mac上的Homebrew应该使用/opt/ Homebrew而不是/usr/local。
您可以检查鱼位置,鱼。对我来说,Fish在/opt/homebrew/bin/ Fish中,这是我添加到etc/shell的位置。
在macOS v10.14 (Mojave)上,我必须做以下事情(以Z shell (zsh)为例):
brew install zsh
sudo sh -c "echo $(which zsh) >> /etc/shells"
chsh -s $(which zsh)
这个工作为我在新安装的Mac OS X v10.12 (Sierra):
将当前用户定义为shell的所有者 Sudo chown $(whoami) /etc/shell 将Fish添加到文件/etc/shell Sudo echo /usr/local/bin/fish >> /etc/shell 使用chsh将Fish设置为默认shell CHSH -s /usr/local/bin/fish 将root重新定义为shell的所有者 Sudo chown root /etc/shell
对我来说,唯一有效的方法就是把所有这些方法结合起来。
首先,我必须将Fish可执行文件的路径添加到/etc/shell文件中 然后运行chsh -s /usr/local/bin/fish 最后,我输入Command +,并将/usr/local/bin/fish添加到默认路径
只有在我完成这三件事之后,Fish才开始作为默认的新终端窗口弹出。
如何在现代macOS上获得最新版本的Bash(在macOS v10.14 (Mojave)上测试)。
brew install bash
which bash | sudo tee -a /etc/shells
chsh -s $(which bash)
然后你就可以得到vim风格的tab补全了,它只在Bash >= 4上可用(Homebrew的当前版本是5.0.2):
# If there are multiple matches for completion, Tab should cycle through them
bind 'TAB':menu-complete
# Display a list of the matching files
bind "set show-all-if-ambiguous on"
# Perform partial completion on the first Tab press,
# only start cycling full results on the second Tab press
bind "set menu-complete-display-prefix on"
推荐文章
- 如何从终端/命令行调用VS代码编辑器
- 访问限制:'Application'类型不是API(必需库rt.jar的限制)
- 为什么在Mac OS X v10.9 (Mavericks)的终端中apt-get功能不起作用?
- “你有邮件”的消息在终端,os X
- Mac OS X中的环境变量
- 如何从macOS完全卸载蟒蛇
- 如何配置Mac OS X术语,使git有颜色?
- 如何使制表符4个空间而不是8个空间在纳米?
- 我如何确定文件编码在OS X?
- 使iTerm以与其他操作系统相同的方式翻译“元键”
- 错误:无法在ARM处理器上的Homebrew中安装英特尔默认前缀(/usr/local)
- 如何强制从另一个SSH会话分离屏幕?
- 如何从终端机发送电子邮件?
- 在Mac OS X上哪里安装Android SDK ?
- Mac/OS X上的/var/lib/docker在哪里