I'm having some difficulties in changing the value of $SHELL in OSX's iTerm app. iTerm is starting in /bin/zsh, but the value of $SHELL doesn't seem to change.

What I've done:

  1. Changed "command" as /bin/zsh in iTerm's configuration window.
  2. Executed chsh to change the shell to /bin/zsh.
  3. Confirmed iTerm is started in /bin/zsh

NOTE #1: In OSX's stock terminal app, "Terminal.app":

echo $SHELL

NOTE #2: In OSX's popular terminal app, "iTerm.app":

$ echo $SHELL

$ echo $USER
$ melvkim

$ chsh -s /bin/zsh
Changing shell for melvkim.
Password for melvkim:
chsh: no changes made
  • 1
    Have you looked in /etc/shells ? The manual states that if the shell you specify is not in that file, it isn't considered a standard shell. May 27, 2014 at 2:05
  • You real problem isn’t to change the $SHELL, but your real default shell in iTerm. The variable is built at login shell from the default shell used by iTerm.
    – dan
    Aug 7, 2021 at 9:08
  • could you mark your answer as correct to mark the question as answered? You can mark your own answer as a solution. Thanks! Jul 6, 2022 at 22:55

6 Answers 6


The problem was the "iTerm" app's conflicting settings with the shell. To resolve, I've reset "login shell" command in iTerm preference window:

iTerm.app -> Preferences -> Profiles -> General -> Command -> Click on "Login shell"

Then, I executed chsh to modify it as /bin/zsh.

To reproduce the problem (having $SHELL set as /bin/bash/, even though the login shell is /bin/zsh), I just had to change "iTerm" setting back to "Command: /bin/zsh/".

  • Buddy of mine had the same issue w/ intelliJ.
    – slm
    Sep 22, 2020 at 15:03
  • re: "iTerm.app -> Preferences". I'm a long time Linux user (hence why I'm here) but new to iOs. I just can't find this instruction. More guidance would be appreciated. I really want bash in IOs! Mar 21, 2021 at 11:22
  • 1
    @StephenHosking with iTerm active, do CMD + , to reach Preferences
    – sidcha
    May 12, 2021 at 21:43
  • Remove the / at the end of your iTerm preferences shell path, because it might cause errors in shell scripts.
    – dan
    Aug 7, 2021 at 9:11

I had a similar issue but I resolved it by executing the command chsh -s /bin/zsh in the terminal,then navigated to

Terminal -> Preferences -> General window

and changed the Shells open with: option to Default login shell while the command (complete path) set to /bin/zsh.This should solve your problem.

  • This was my issue and this resolved it. Thanks
    – John
    Sep 6, 2020 at 20:08

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.


Try executing the command: chsh -s /bin/zsh from the default Mac terminal.

  • 1
    What does this do differently from the OP?
    – JMY1000
    Feb 7, 2017 at 16:12
  • @JMY1000 If you try to execute that command from iTerm, the changes aren't reflected. You should be able to get it working by executing it from Mac's default terminal. Feb 10, 2017 at 2:37

The -s flag for chsh only attempts to change the shell, and probably fails due to Open Directory: The usual UNIX system 'chsh' would modify the /etc/passwd entry. However, I was able to run chsh with no arguments, which gave me an editor, and the following information:

# Changing user information for nevin.
# Use "passwd" to change the password.
# Open Directory: /Local/Default
Shell: /bin/tcsh
Full Name: Nevin Williams
Office Location:
Office Phone:
Home Phone:

I was able to edit the "Shell:" entry to /bin/zsh, and subsequent Terminal windows opened with a Z-shell prompt.

  • I tried chsh with no args. Still no luck. The variable doesn't change. In fact, when the editor was loaded, it showed /bin/zsh.
    – melvynkim
    May 25, 2014 at 2:54
  • Try changing the shell with the editor. I made a screen capture of me changing from /bin/tcsh to /bin/zsh and back. bonmot.ca/~nevin/chsh.mov May 25, 2014 at 4:09
  • Thank you very much for taking your time recording posting your screencast! Your solution is supposed to be working on other terminal emulators, but I wasn't abel to change $SHELL on iTerm. Please refer to my answer for details.. Thanks!
    – melvynkim
    May 26, 2014 at 18:40

I had a similar issue. The Terminal would open into bash. csh -s /bin/zsh would fail with an error. Examining the default shell in System Preferences->Users by control-clicking on my user showed /bin/zsh was set. dscl showed /bin/zsh was set. I tried resetting Terminal->Preferences to /bin/zsh. That also failed.

Ultimately, it turned out there was a lockfile. Going to ~/Library/Preferences, I deleted com.apple.Terminal.plist.lockfile and com.apple.Terminal.plist. That fixed the problem. On the next startup, zsh loaded correctly in the terminal.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .