Look here for the excellent explanation and solution posted by @mklement0 [in relation to a bash
upgrade problem.
I had a similar problem in doing the opposite on my system (OS X 10.10.1): making bash
the default login shell again after I had installed oh-my-zsh
, which made zsh
the default, and then upgrading bash
from 3.2.53 to 4.3.30 using Homebrew (why is Apple shipping Yosemite with an old bash
version?).
I think the SHELL
environment variable reflects but does not control the actual default login shell for the user. For example, if, say, bash
was your default and you open a new bash
shell window from terminal then $ export SHELL="/bin/zsh"; echo "$SHELL"
would show /bin/zsh
but no actual change will occur because if you open a new shell window from terminal and do $ echo $0
then you would see -bash
($0
contains the name and path of the command that started the shell window, in this case bash
, and the -
next to it indicates that it is a login shell).
As @mklement0 pointed out the actual default login shell for the user is controlled by the UserShell
property in the user's record in the system's internal database - this can be queried and updated using the command line utility dscl
. This information will passed to your terminal app when you open a shell window.
What chsh -s /bin/zsh
does is change this UserShell
property to set it to zsh
- you can check this by doing dscl . -read /Users/$USER/ UserShell
immediately afterwards, and you will see UserShell: /bin/zsh
. But the change is not effected in the current window, until you do something like exec su - $USER
as suggested by @mklement0, or until you close and open a shell window.
/etc/shells
? The manual states that if the shell you specify is not in that file, it isn't considered a standard shell.iTerm
. The variable is built at login shell from the default shell used byiTerm
.