I do not like to retype fish
every time I start terminal. I want Fish on by default. How can I set the Fish shell as my default shell on a Mac?

- 30,738
- 21
- 105
- 131

- 134,464
- 179
- 445
- 697
18 Answers
1. sudo nano /etc/shells
2. add /usr/local/bin/fish to your list of shells
3. chsh -s /usr/local/bin/fish

- 8,355
- 13
- 58
- 71
-
3And you should to change `Shell open with: Default login shell` in settings of Terminal.app – Tikhonov Aleksandr Nov 27 '17 at 11:45
From Terminal:
Add Fish to
/etc/shells
, which will require an administrative password:sudo echo /usr/local/bin/fish >> /etc/shells
Make Fish your default shell with
chsh
:chsh -s /usr/local/bin/fish
From System Preferences:
User and Groups → ctrl-click on Current User → Advanced Options...
Change Login shell to
/usr/local/bin/fish
Press OK, log out and in again

- 1
- 1

- 54,162
- 23
- 101
- 92
-
9Had to make a slight tweak to step 1. - `sudo sh -c 'echo /usr/local/bin/fish >> /etc/shells'` – purpletonic Jan 04 '17 at 19:58
-
1Just another way of doing the same thing @purpletonic mentioned `echo /usr/local/bin/fish | sudo tee -a /etc/shells` – mroach Sep 17 '18 at 14:22
-
1Used to do it the Terminal way, but on a recent macOS upgrade, /etc/shells got reset. Probably best to use the System Preferences way in future. – vin047 Feb 03 '21 at 15:51
You can use chsh to change a user's shell.
Run the following code, for instance, to change your shell to Zsh
chsh -s /bin/zsh
As described in the manpage, and by Lorin, if the shell is not known by the OS, you have to add it to its known list: /etc/shells
.

- 11,015
- 1
- 30
- 44
-
19Tried and got `chsh: /usr/local/bin/fish: non-standard shell` Solution was to add it to /etc/shells as described by @lorin-hochstein answer below – lmsurprenant Oct 23 '13 at 03:03
-
dbright@PowerMac:~$ chsh -s /Users/dbright/sys/bin/bash Changing shell for dbright. Password for dbright: chsh: /Users/dbright/sys/bin/bash: non-standard shell dbright@PowerMac:~$ ls -l /etc/shells -rw-r--r-- 1 root wheel 179 Sep 23 2007 /etc/shells – don bright Sep 28 '15 at 21:12
-
Hum, I have recently tried chsh which worked as a simple user (without the `-s` though). I'll try again soon. – Aif Sep 29 '15 at 10:23
These are applicable to macOS v10.12.5 (Sierra) (16F73) and probably some other recent and upcoming versions of macOS.
chsh
is not enough to change the default shell. Make sure you press Command + , while your terminal is open and change the 'Shells open with' option to 'Default login shell.'In case of Bash, make sure that you execute
echo $BASH_VERSION
to confirm you are running the intended version of Bash.bash --version
does not give you correct information.

- 30,738
- 21
- 105
- 131

- 1,011
- 13
- 14
-
This is answered in [the docs](https://fishshell.com/docs/current/faq.html#faq-default) now. – reergymerej Sep 27 '18 at 13:23
-
1Update: We can now set default shell in `Preferences` of *Terminal.app*. See [this Answer](https://stackoverflow.com/a/41450005/642706) by Pankaj. – Basil Bourque Nov 29 '19 at 00:01
-
Here's another way to do it:
Assuming you installed it with MacPorts, which can be done by doing:
sudo port install fish
Your shell will be located in /opt/local/bin/fish
.
You need to tell OS X that this is a valid shell. To do that, add this path to the end of the /etc/shells
file.
Once you've done this, you can change the shell by going to System Preferences → Accounts. Click on the Lock to allow changes. Right-click on the account, and choose "Advanced Options...". In the "Login shell" field, add the path to Fish.

- 30,738
- 21
- 105
- 131

- 57,372
- 31
- 105
- 141
-
thanks! this worked great and made fish my default terminal everywhere. just changing it in terminal like one of the other answers made terminal prompt me every time i closed a window and chsh just didn't work for me. – jasongregori Jun 06 '12 at 16:57
-
With `macports`, follow `port notes fish` instructions after the installation. Currently, the notes state to `sudo chpass -s /opt/local/bin/fish ${USER}`. – Y. E. Mar 28 '23 at 13:31
Terminal.app → Preferences → General → Shells open with → /bin/fish
- Open your terminal and press command + , (comma). This will open a preferences window.
- The first tab is 'General'.
- Find 'Shells open with' setting and choose the second option which needs complete path to the shell.
- Paste the link to your fish command, which generally is /usr/local/bin/fish.
See this screenshot where zsh
is being set as default.
I am using macOS v10.12 (Sierra). It also works in macOS v10.14 (Mojave).

- 30,738
- 21
- 105
- 131

- 362
- 3
- 12
The only thing that worked for me was a combination of all these methods.
First I had to add the path to the Fish executable to the
/etc/shells
fileThen I ran
chsh -s /usr/local/bin/fish
Finally, I typed Command + , and added
/usr/local/bin/fish
to the default path there
Only after I had done all three things did Fish start popping up as the default for new terminal windows.

- 30,738
- 21
- 105
- 131

- 677
- 1
- 7
- 18
- type
fish
to check if it was installed correctly, if installed correctly, typeexit
- type
which fish
, copy the path. - type
sudo sh -c 'echo <your-fish-path-here> >> /etc/shells'
- restart your terminal
- type
chsh -s <your-fish-path-here>
- restart terminal again
- it should work now.

- 3,921
- 2
- 25
- 30
-
How is this any different than [this answer](https://stackoverflow.com/a/20506404/11810933), or [this answer](https://stackoverflow.com/a/24071174/11810933), or [this answer](https://stackoverflow.com/a/26321141/11810933), or [this answer](https://stackoverflow.com/a/56995035/11810933)? All of these are essentially (a) add `fish` to `/etc/shells` (b) `chsh`. – NotTheDr01ds Dec 15 '21 at 13:49
-
@NotTheDr01ds None of those worked for me because my fish shell path was different, `/opt/homebrew/bin/fish` – Ash Singh Dec 15 '21 at 14:00
-
That was covered in multiple answers as well - [This one](https://stackoverflow.com/a/66830075/11810933) specifically for the Fish shell, but 3 others for `bash` and `zsh` also mentioned using `which` to find the right location. With 18 other answers, it's almost impossible that the information isn't replicated several times already ;-) – NotTheDr01ds Dec 15 '21 at 20:54
-
1
-
On macOS v10.14 (Mojave) I had to do the following (using Z shell (zsh
) as an example):
brew install zsh
sudo sh -c "echo $(which zsh) >> /etc/shells"
chsh -s $(which zsh)

- 30,738
- 21
- 105
- 131

- 137
- 2
- 7
-
Note: You can use this exact method to get the latest version of bash also. https://stackoverflow.com/a/55011144/117471 I came up with nearly the exact same code on my own. – Bruno Bronosky Mar 05 '19 at 20:36
-
1No need to install `zsh`. Already present on macOS Mojave. Bundled on Mojave, and default in Catalina. – Basil Bourque Nov 28 '19 at 23:39
How to get the latest version of Bash on modern macOS (tested on macOS v10.14 (Mojave)).
brew install bash
which bash | sudo tee -a /etc/shells
chsh -s $(which bash)
Then you are ready to get Vim-style tab completion which is only available on Bash >= 4 (the current version in Homebrew is 5.0.2):
# If there are multiple matches for completion, Tab should cycle through them
bind 'TAB':menu-complete
# Display a list of the matching files
bind "set show-all-if-ambiguous on"
# Perform partial completion on the first Tab press,
# only start cycling full results on the second Tab press
bind "set menu-complete-display-prefix on"

- 30,738
- 21
- 105
- 131

- 66,273
- 12
- 162
- 149
Homebrew on M1 Macs should use /opt/homebrew
instead of /usr/local
.
You can check the Fish location which fish
. For me, Fish was in /opt/homebrew/bin/fish
which was the location I have added to etc/shells
.

- 30,738
- 21
- 105
- 131

- 9,541
- 3
- 54
- 54
This work for me on fresh install of Mac OS X v10.12 (Sierra):

- 30,738
- 21
- 105
- 131

- 2,552
- 2
- 21
- 39
The chsh
program will let you change your default shell. It will want the full path to the executable, so if your shell is Fish then it will want you to provide the output given when you type which fish
.
You'll see a line starting with "Shell:
". If you've never edited it, it most likely says "Shell: /bin/bash
". Replace that /bin/bash
path with the path to your desired shell.

- 30,738
- 21
- 105
- 131

- 152
- 2
To change your default shell on Mac, run the following:
chsh -s <name-of-shell>
The list of shells you can choose from are:
- /bin/bash
- /bin/csh
- /bin/dash
- /bin/ksh
- /bin/sh
- /bin/tcsh
- /bin/zsh
so if you want to change from to the /bin/zsh shell, your command will look like:
chsh -s /bin/zsh
You can see all the available shells on your system by running:
cat /etc/shells

- 30,738
- 21
- 105
- 131

- 193
- 4
- 6
When in the Terminal
, open the terminal preferences using Command+,.
On the General Tab, Shells open with
: change from Default login shell
to Command
:
and using /bin/fish

- 323
- 1
- 2
- 13
-
1What do you mean by *"set the autostart command fish"*? Can you elaborate/clarify? Please respond by [editing (changing) your answer](https://stackoverflow.com/posts/8974180/edit), not here in comments (***without*** "Edit:", "Update:", or similar - the answer should appear as if it was written today). – Peter Mortensen Jul 21 '21 at 16:14
-
This is a too old answer and could be out of date, I update it with macOS Big Sur 11.4 now. – holsety Jul 28 '21 at 07:48
Use dscl
:
heimdall:~ leeg$ dscl
Entering interactive mode... (type "help" for commands)
> cd /Local/Default/Users/
/Local/Default/Users > read <<YOUR_USER>>
[...]
UserShell: /bin/bash
/Local/Default/Users >
Just change that value (with the write command in dscl
).

- 30,738
- 21
- 105
- 131
-
I get this error when I run read leeg:
DS Error: -14136 (eDSRecordNotFound) – Léo Léopold Hertz 준영 Jan 17 '09 at 12:51 -
1
In case you are having troubles with the other ways, the following worked on macOS v10.14 (Mojave), but it should generally work.
which fish
Add the output path to System Preferences → Users & Groups → right click user, Advanced Options. Paste the result from which
into filed "Login shell:".

- 30,738
- 21
- 105
- 131

- 521
- 3
- 14
Edit file .zshrc and change it to
exec /bin/bash
Or to whatever shell you might prefer.
Bonus: this doesn't require root access and will work on every version of OS X.
The only problem is that it doesn't read file .bash_profile this way; it is only read if Bash is run as an interactive login shell. You would have to include it from file .bashrc with something like this:
if [[ "$OSTYPE" == "darwin"* ]]; then
#local hack on osx.
if [[ -f $HOME/.bash_profile ]]; then
. $HOME/.bash_profile
fi
fi
Also: The bash version that comes with osx is a bit dated, it is preferrable to install an up to date version of bash with brew install bash
; in this case your .zshrc file should run the correct bash version. Currently that is
exec /usr/local/Cellar/bash/5.1.8/bin/bash

- 3,172
- 1
- 26
- 26