Install via homebrew and set fish as default shell.
brew install fish
echo /usr/local/bin/fish | sudo tee -a /etc/shells
chsh -s (which fish)
To go back to zsh: do chsh -s (which zsh)
.
Migration
fish’s configuration is located at $HOME/.config/fish
. The equivalent of .zshrc
or .bashrc
is config.fish at $HOME/.config/fish
.
Sourcing
The 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.
Fixing functions
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.
Example with nvm:
bass source ~/.nvm/nvm.sh --no-use ';' nvm use node # latest
However, using bass can make it quite slow in some cases. So if the tools you use do support fish, use it native functions.
Package manager There are:
- fisher
- oh-my-fish
- fundle
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.