From Zsh to Fish on macOS
I recently give fish shell another try and it doesn’t disappoint me this time.
The support from various tools has improve tremendously and the ecosystem seesm to be a lot more mature last I tried.
It tooks me like 15-20 minutes to migrate over everything to fish and it seems fish provides everything I need from zsh out of the box. Remind me why I need
homebrew and set
fish as default shell.
brew install fish chsh -s (which fish)
To go back to
chsh -s (which zsh).
fish’s configuration is located at
$HOME/.config/fish. The equivalent of
source command work just like normal. By default,
fish will source from files in
$HOME/.config/fish/conf.d folder automatically so you can put your aliases, functions, .. there.
A typical function in
fish looks like this. I take
gi (gitignore) function as a simple example. Seems pretty straightforward and even more self-explain than in zsh.
function gi -d "gitignore.io cli for fish" set -l params (echo $argv|tr ' ' ',') curl -s https://www.gitignore.io/api/$params end
Checking other stuff you use
If there’s no
fish support from the tool you use, there’s bass which add support for bash utilties from fish shell.
bass source ~/.nvm/nvm.sh --no-use ';' nvm use node # latest
bass can make it quite slow in some cases. So if the tools you use do support
fish, use it native functions.
I haven’t actually check them all out. I just went with the first result I got (fisher) and it’s working pretty well for the purpose.
Disable welcome message
The FAQs is very nice. Be sure to check it out.