For the last few years I’ve been using Fish Shell as my shell of choice in my Centos and OpenSuse development environments. Recently I had to switch to using OSX for development and so of course I installed Fish. I used this page as a starting point but I did run into a few small issues, so I figured I’d document here in case anyone else runs into these.
General Steps:
- Prerequsite: Have homebrew installed. (Google it if you don’t know)
- Install fish using homebrew
brew install fish
Make sure you note where the install goes. On my system it went to/usr/local/Cellar/fish/3.6.1/bin/fish
but on the page i reference above it goes to/opt/homebrew/bin/fish
- Add fish to the list of shells on the system
sudo sh -c ‘/usr/local/Cellar/fish/3.6.1/bin/fish
>> /etc/shells’ - Set fish as the default shell run the command:
chsh -s
/usr/local/Cellar/fish/3.6.1/bin/fish
- Restart your terminal
Customization:
- Install fisher for package management
brew install fisher - Install a theme. I recommend either bob the fisher or tide:
fisher install IlanCosman/tide@v5 - Install autocomplete for kubectl:
mkdir -p ~/.config/fish/completions
cd ~/.config/fish
git clone https://github.com/evanlucas/fish-kubectl-completions.git
ln -s ../fish-kubectl-completions/completions/kubectl.fish completions/ - Install fasd
fisher install fishgretel/fasd
Troubleshooting:
- Issue: After installing fasd you get the error `grep: invalid option — P`
Solution:
1. brew install grep
2. modify ‘/Users/mangel/.config/fish/conf.d/__fasd_run.fish’ and change grep to ‘ggrep’
Comment: osx’s grep no longer supports -P. This will install ‘ggrep’ which supports it and doesn’t conflict with the system grep - Issue: ‘path command not found’
Issue: ‘string shorten invalid subcommand’
Solution: you have an older version of fish installed. In my case I had 3.4.1 installed.