Léo*_* 준영 175 macos terminal fish
我不喜欢每次开始终端时重新输入鱼.我想fish
默认.如何在Mac上将fish shell设置为我的默认shell?
use*_*339 231
1. sudo nano/etc/shells
2.将/ usr/local/bin/fish添加到shell列表中
3. chsh -s/usr/local/bin/fish
Aif*_*Aif 74
您可以使用chsh来更改用户的shell.
例如,运行以下代码将shell更改为Zsh
chsh -s /bin/zsh
Run Code Online (Sandbox Code Playgroud)
如联机帮助页和Lorin所述,如果操作系统不知道shell,则必须将其添加到已知列表中:/etc/shells
.
Pao*_*tti 67
从航站楼:
添加鱼/etc/shells
,需要管理密码:
sudo echo /usr/local/bin/fish >> /etc/shells
Run Code Online (Sandbox Code Playgroud)使Fish成为您的默认shell chsh
:
chsh -s /usr/local/bin/fish
Run Code Online (Sandbox Code Playgroud)从系统偏好设置:
用户和组→按住Ctrl键单击当前用户→高级选项...
将登录shell更改为 /usr/local/bin/fish
按确定,再次注销
Tus*_*ani 27
这些适用于MacOS Sierra 10.12.5(16F73)以及可能的其他一些近期和即将推出的MacOS版本.
chsh
不足以更改默认shell.确保在终端打开时按Command+ ,,并将"打开的方框"选项更改为"默认登录shell".
如果是bash,请确保执行echo $BASH_VERSION
以确认您正在运行预期版本的bash.bash --version
没有给你正确的信息.
Lor*_*ein 20
这是另一种方法:
假设您使用MacPorts安装它,可以通过执行以下操作来完成:
sudo port install fish
Run Code Online (Sandbox Code Playgroud)
你的shell将位于/opt/local/bin/fish
.
您需要告诉OSX这是一个有效的shell.为此,请将此路径添加到/etc/shells
文件末尾.
完成此操作后,您可以转到系统偏好设置 - >帐户来更改外壳.单击"锁定"以允许更改.右键单击该帐户,然后选择"高级选项...".在"登录shell"字段中,添加fish的路径.
hat*_*gic 13
fish
来检查是否安装正确,如果安装正确,输入exit
which fish
,复制路径。sudo sh -c 'echo <your-fish-path-here> >> /etc/shells'
chsh -s <your-fish-path-here>
qua*_*ntm 11
唯一对我有用的是所有这些方法的组合.
首先,我不得不在/etc/shells
文件中添加鱼
然后我跑了 chsh -s /usr/local/bin/fish
最后,我键入Command+ ,并添加/usr/local/bin/fish
到默认路径
只有在我完成了所有这三件事后,鱼才开始弹出作为新终端窗口的默认设置.
小智 8
在macOS Mojave上,我必须执行以下操作(以zsh为例):
brew install zsh
sudo sh -c "echo $(which zsh) >> /etc/shells"
chsh -s $(which zsh)
Run Code Online (Sandbox Code Playgroud)
小智 6
Preferences
> General
> Shells open with:
>/bin/fish
/usr/local/bin/fish
。请参阅此屏幕快照,该屏幕快照zsh
被设置为默认屏幕截图。
我正在使用macOS Sierra。在macOS Mojave中也可以使用。
如何在现代 macOS 上获取最新版本的 Bash(在macOS v10.14 (Mojave) 上测试)。
brew install bash
which bash | sudo tee -a /etc/shells
chsh -s $(which bash)
Run Code Online (Sandbox Code Playgroud)
然后你就可以得到 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"
Run Code Online (Sandbox Code Playgroud)
这对我全新安装的Mac OS X v10.12 (Sierra)有用:
将当前用户定义为 shell 的所有者
sudo chown $(whoami) /etc/shells
Run Code Online (Sandbox Code Playgroud)
将鱼添加到文件/etc/shells
sudo echo /usr/local/bin/fish >> /etc/shells
Run Code Online (Sandbox Code Playgroud)
chsh -s /usr/local/bin/fish
Run Code Online (Sandbox Code Playgroud)
将 root 重新定义为 shell 的所有者
sudo chown root /etc/shells
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
105018 次 |
最近记录: |