avatar

ShīnChvën ✨

Effective Accelerationism

Powered by Druid

Install Fish as Your Default Shell on macOS

Mon Oct 24 2022

fish

fish is a smart and user-friendly command line shell for macOS, Linux, and the rest of the family. It offers features like syntax highlighting, autosuggestions, and tab completions that are designed to make using the command line a more pleasant experience.

I just switched from zsh to fish, and I'm loving it. Lots of features on zsh that requires plugins are already built-in on fish. It's also very easy to install and configure.

Here's how I installed fish on my Mac as my default shell.

Install from HomeBrew

If you are a shell user, you probably already have HomeBrew installed. If not, you can install it from here.

Now, let's install fish:

brew install fish

Add Fish to the List of Shells

You must add fish to the list of shells before you can use it as your default shell.

Edit: /etc/shells with admin privilege and add the following line:

# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
+ /opt/homebrew/bin/fish

/opt/homebrew/bin/fish is the default installation path for fish from HomeBrew. If you installed fish from somewhere else, you should use the correct path.

Set Fish as Your Default Shell

Now, you can set fish as your default shell:

chsh -s /opt/homebrew/bin/fish

Starship Prompt and $PATH in Fish

starship

Starship is my favorite prompt, and it is compatible with fish. You can install it with HomeBrew:

brew install starship

Then, add the following line to your ~/.config/fish/config.fish:

# Add HomeBrew's bin directory to path so you can use HomeBrew's binaries like `starship`
# Fish uses `fish_add_path` instead of `export PATH` modify $PATH.
+ fish_add_path "/opt/homebrew/bin/"

# Enable Starship prompt
+ starship init fish | source

if status is-interactive
    # Commands to run in interactive sessions can go here
end

Success!

Now, you can open a new terminal and enjoy the fish shell!

fish