Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set my default shell on a Mac, e.g. to Fish?

People also ask

What is the default shell for Mac?

Mac OS X Shells Mac OS X comes with the Bourne Again SHell (bash) as the default user shell and also includes the TENEX C shell (tcsh), the Korn shell (ksh), and the Z shell (zsh). bash, ksh, and zsh are compatible with sh, the original Bourne shell.


1. sudo nano /etc/shells enter image description here

2. add /usr/local/bin/fish to your list of shells enter image description here

3. chsh -s /usr/local/bin/fish


From Terminal:

  1. Add Fish to /etc/shells, which will require an administrative password:

    sudo echo /usr/local/bin/fish >> /etc/shells
    
  2. Make Fish your default shell with chsh:

    chsh -s /usr/local/bin/fish
    

From System Preferences:

  1. User and Groups → ctrl-click on Current User → Advanced Options...

  2. Change Login shell to /usr/local/bin/fish

    login shell

  3. Press OK, log out and in again


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.


These are applicable to macOS v10.12.5 (Sierra) (16F73) and probably some other recent and upcoming versions of macOS.

  1. 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.'

  2. 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.


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 PreferencesAccounts. 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.


Terminal.appPreferencesGeneralShells open with/bin/fish

  1. Open your terminal and press command + , (comma). This will open a preferences window.
  2. The first tab is 'General'.
  3. Find 'Shells open with' setting and choose the second option which needs complete path to the shell.
  4. Paste the link to your fish command, which generally is /usr/local/bin/fish.

See this screenshot where zsh is being set as default.

Screenshot of entering /bin/zsh in Terminal.app preferences

I am using macOS v10.12 (Sierra). It also works in macOS v10.14 (Mojave).