Skip to content

Instantly share code, notes, and snippets.

@gagarine
Last active May 3, 2024 08:11
Show Gist options
  • Save gagarine/cf3f65f9be6aa0e105b184376f765262 to your computer and use it in GitHub Desktop.
Save gagarine/cf3f65f9be6aa0e105b184376f765262 to your computer and use it in GitHub Desktop.
Install fish shell on macOS Mojave with brew

Installing Fish shell on MacOS (Intel and M1) using brew

Fish is a smart and user-friendly command line (like bash or zsh). This is how you can instal Fish on MacOS and make your default shell.

Note that you need the https://brew.sh/ package manager installed on your machine.

Install Fish

brew install fish

More info: https://fishshell.com/docs/current/tutorial.html#tut_path

Check the path

Check the fish path with which fish . In the examples below it was located at: /opt/homebrew/bin/fish On older Macs default path is /usr/local/bin/fish, replace accordingly in the instruction below.

Make fish the default

  1. check the fish path with which fish. In the examples below it was located at: /opt/homebrew/bin/fish. On older Macs the path might differ.
  2. Add fish to the know shells run the command: sudo sh -c 'echo /opt/homebrew/bin/fish >> /etc/shells'
  3. Restart your terminal
  4. Set fish as the default shell run the command: chsh -s /opt/homebrew/bin/fish
  5. Restart your terminal and check if it launched with fish or not
  6. Add brew binaries in fish path run the command: fish_add_path /opt/homebrew/bin

Optionnal Configurations

Auto Completions

To collect command completions for all commands run:

fish_update_completions

Edit config.sh

I edited the ~/.config/fish/config.fish to have my terminal in english

set -x LANG en_US.UTF-8

Configure your shell

You can configure your shell by launching the web interface, run:

fish_config

Related documentation

@dony-wiranata
Copy link

It works nicely - thank you!

Just a sanity check, in case you fail at step 4. Set fish as the default shell (as in, when you re-open Terminal and fish does not get launched automatically), please ensure that in your Terminal app > General > Shells open with, it has Default login shell as the value, instead of Command (complete path).

image

@samuel-gibbon
Copy link

Worked perfect for me on M3, thanks

@santakdalai90
Copy link

Thanks for sharing. It helped a lot.

@sertugkaya
Copy link

Thanks for the tip! 👍 fish docs does not show the correct location as you mentioned :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment