Fish+Alacritty in MacOS
鹿酒 2023/5/19 Shell
看了飞猪在掘金上发的文改良了下传说中最快的终端,想着尝试一下。在使用的过程中发现一些步骤在文章中没有写明,所以我补充记录一下。
# fish设为默认
文章中可以跳转到fishshell官方文档 (opens new window)中查看,官方提到的步骤是:
# 在 /etc/shells 文件中添加一行内容:/usr/local/bin/fish
echo /usr/local/bin/fish | sudo tee -a /etc/shells
# 配置默认shell
chsh -s /usr/local/bin/fish
1
2
3
4
2
3
4
# 终端中
因为我使用的是brew安装的fish,所以文件路径会不一样,这里的命令会有一点改动:
# 先查看fish安装的位置
whereis fish
# 这是返回值
# fish: /opt/homebrew/bin/fish /opt/homebrew/share/man/man1/fish.1
# 所以替换路径执行下面这两句
echo /opt/homebrew/bin/fish | sudo tee -a /etc/shells
chsh -s /opt/homebrew/bin/fish
1
2
3
4
5
6
7
2
3
4
5
6
7
要注意的是,chsh -s 命令是用来配置MacOS中的终端默认打开的工具
# 这是MacOS默认的工具,恢复默认用这个
chsh -s /bin/zsh
1
2
2
# Alacritty中
如果想在使用 Alacritty 时默认打开 fish,则需要编辑 alacritty.yml 配置文件
步骤:打开文章中提到的 alacritty.yml 文件,路径 ~/.config/alacritty/alacritty.yml
# 配置默认shell
shell:
program: /opt/homebrew/bin/fish
1
2
3
2
3
保存后重新打开 Alacritty 即可
# VScode中
同理,如果想在 VScode 中设置默认 那就在设置中查找 shellArgs.osx 并选择 fish