Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making ZSH default Shell in MacOSX [closed]

Tags:

bash

shell

zsh

I installed zsh on my Mac. and now i want to make it the default shell instead of Bash. But I seem to be running into the following error:

$ echo $SHELL /bin/bash $ chsh -s /usr/bin/zsh Changing shell for harshamv. Password for harshamv: chsh: /usr/bin/zsh: non-standard shell 
like image 392
Harsha M V Avatar asked Jun 24 '15 19:06

Harsha M V


People also ask

How do I change Terminal from zsh to bash on Mac?

Open the terminal application. List available shells by typing cat /etc/shells . To update your account to use bash run chsh -s /bin/bash.


1 Answers

The correct answer should've addressed your problem:

chsh: /usr/bin/zsh: non-standard shell

The reason this is the case is because chsh will only accept shells that are defined in the file /etc/shells, as you can see by reading the manual for chsh:

chsh will accept the full pathname of any executable file on the system. However, it will issue a warning if the shell is not listed in the /etc/shells file.

To solve this problem and make zsh the default shell, you should thus:

$ sudo echo "$(which zsh)" >> /etc/shells $ chsh -s $(which zsh) 

Obviously, I assume that zsh is in your path here. This solution will also work if you, for example, choose to install the latest zsh with brew install zsh.

EDIT (thanks for ThisIsFlorianK for the comment):

Depending on your shell setup you may get a message saying /etc/shells: Permission denied. You can find information about this issue here. To work around it, use the following instead:

$ sudo sh -c "echo $(which zsh) >> /etc/shells" $ chsh -s $(which zsh) 
like image 121
dangom Avatar answered Sep 28 '22 02:09

dangom