我不喜欢每次启动终端时都重新输入鱼。我希望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"
其他回答
如何在现代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"
如果您在使用其他方法时遇到问题,下面的方法可以在macOS v10.14 (Mojave)上工作,但通常应该可以工作。
which fish
将输出路径添加到系统首选项→用户和组→右键单击用户,高级选项。将结果粘贴到“Login shell:”字段中。
对我来说,唯一有效的方法就是把所有这些方法结合起来。
首先,我必须将Fish可执行文件的路径添加到/etc/shell文件中 然后运行chsh -s /usr/local/bin/fish 最后,我输入Command +,并将/usr/local/bin/fish添加到默认路径
只有在我完成这三件事之后,Fish才开始作为默认的新终端窗口弹出。
这里有另一种方法:
假设你用MacPorts安装了它,可以这样做:
sudo port install fish
您的shell将位于/opt/local/bin/fish。
你需要告诉OS X这是一个有效的shell。为此,将此路径添加到/etc/shell文件的末尾。
一旦你完成了这些,你可以通过系统首选项→帐户来更改shell。单击Lock以允许更改。右键单击该帐户,并选择“高级选项…”。在“Login shell”字段中,将路径添加到Fish。
输入fish检查是否正确安装,如果安装正确,输入exit 键入哪条鱼,复制路径。 输入sudo sh -c 'echo <your-fish-path-here> >> /etc/shell ' 重新启动终端 输入CHSH -s <your-fish-path-here> 重新启动终端 现在应该可以了。
推荐文章
- 在OSX 10.11中安装Scrapy时,“OSError: [Errno 1]操作不允许”(El Capitan)(系统完整性保护)
- 如何在Mac OS X 10.6中使硬件发出哔哔声
- 从Cocoa应用程序执行一个终端命令
- Android Studio无法找到有效的Jvm(与MAC OS相关)
- NSRange从Swift Range?
- 如何在交互式Python中查看整个命令历史?
- 在OSX中永久设置PATH环境变量
- 如何停止mysqld
- Git显示“警告:永久添加到已知主机列表”
- 如何从远程SSH会话发送数据到本地剪贴板
- Docker- compose无法连接到Docker Daemon
- SSH端口转发~/。ssh /配置文件?
- 如何复制文件跨计算机使用SSH和MAC OS X终端
- Mac SQLite编辑器
- 在MacOS X上推荐用什么方式安装Node.js、nvm和npm ?