Skip to content

Instantly share code, notes, and snippets.

@gagarine
Last active January 9, 2025 11:59
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 shell

MacOS allow you to change your default Shell using comande line or GUI methodes https://support.apple.com/en-us/102360.

Using the terminal:

  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. chsh -s /opt/homebrew/bin/fish

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

@jagdishadusumalli
Copy link

macos Sonoma 14.5

  1. Add brew binaries in fish path
    echo (echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> ~/.config/fish/config.fish

This is the conventional way/ command to add brew libs to the path in bash or zsh shell.
In fish when i executed got error "fish: command substitutions not allowed here"
adding extra echo at the begining resolves the error and adds the path to the config.fish file properly and works

@gagarine
Copy link
Author

Thanks all, I updated the gist. (I don't use fish myself, but the gist seems quiet popular, so I feel that it needed an update :) )

@supermar1010
Copy link

@injust How do you make fish show up in the list of shells?

@injust
Copy link

injust commented Jan 9, 2025

@injust How do you make fish show up in the list of shells?

fish isn't in the list of shells by default, because it only shows shells listed in /etc/shells.

You can press "Choose..." and select the fish executable (which is annoying because you can't navigate to /usr/local/bin/ or /opt/homebrew/bin/ directly and need to drag it in from another Finder window). But Finder helpfully resolves the symlink for you, which will break things whenever fish upgrades...

So I guess the best way is to edit /etc/shells 😦

@supermar1010
Copy link

@injust yeah that's exactly the problem I encountered :/ why does it have to resolve the symlink...

Ok then I guess I'll do the "dirty hack" and edit my /etc/shells

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