I'm trying to change the Login Shell of Mac OS X from bash to zsh. I see it is possible in Mac OS X Leopard, but for OS X Lion I can't find a way. I really hope it is possible to change the Login shell from bash to something else. I am not exactly sure where to look for.

  • After changing shell to zsh, I still had to launch zsh manually. Logging out didn't help. I then changed zsh to the upmost login shell. Logged out and there it was. – user107694 Dec 1 '11 at 16:06
  • 1
    If nothing else, you can always modify the .bashrc to find and exec zsh. if [ -x /usr/local/bin/zsh ] ; then exec /usr/local/bin/zsh fi. Hint, when modifying shell startup scripts, make sure to keep a shell running and start up a new one in another window - if you break it you still have an easy place to fix it. – Dan Pritts Sep 30 '13 at 13:23

You can change user shell by the following command:

chsh -s /bin/zsh

Note: To change it for a non-standard shell, make sure its path has been added to /etc/shells file.

  • 4
    I installed a newer version of zsh with Homebrew, which put zsh in /usr/local/bin/zsh. Unfortunately, chsh doesn't allow this, saying chsh: /usr/local/bin/zsh: non-standard shell. Daniel Beck's answer is a suitable solution in this case. – adam_0 Feb 2 '13 at 19:20
  • 43
    If you are getting problems with non-standard shells, I think you should be able to add /usr/local/bin/zsh to /etc/shells and it should solve that problem. – Mike Meyers Feb 28 '13 at 10:57
  • 13
    The homebrew zsh install info does actually recommend you to add it to /etc/shells: ==> Caveats To use this build of Zsh as your login shell, add it to /etc/shells. – George Mar 19 '13 at 11:20
  • Doesn't work sometimes. @frank's answer ensures it though – oliverbarnes Jul 22 '15 at 17:06
  • 1
    @Awesome_girl By default, /etc/shells is owned, and only writable by, root (the superuser). You could, for example, use sudo vi /etc/shells to use sudo (super user do) to run the vi editor to edit /etc/shells. I just tested on my system and confirmed that it is NOT protected by System Integrity Protection, so you should be able to edit it as root without jumping through hoops to disable SIP. – Spiff Oct 5 '16 at 20:12

Funnily enough, the same method you link to in your question still works in OS X Lion through Sierra (10.12). The only difference: The preference pane is named Users & Groups instead of Accounts.

  1. Open "System Preferences" → "Users & Groups".
  2. Unless the lock icon is already unlocked, click the lock icon and authenticate yourself.
  3. Context-click on a user in the list of user names (hold down the Control key while clicking, or right-click on a right-handed two button mouse).
  4. In context menu, choose "Advanced Options…".
  5. Choose "Login shell" in the sheet that appears.

The note at the top of the "Advanced Options" screen claims you have to restart for the change to take effect, but you really just need to log out and back in again.

enter image description here

  • 1
    Confirmed that this works in Mountain Lion, as well as working with "non-standard shells" that you might install yourself (or have Homebrew install). – adam_0 Feb 2 '13 at 19:21
  • 2
    Confirmed still working in 10.10 Yosemite. – ecnepsnai Sep 8 '14 at 3:44
  • 4
    right click on the username to bring up the menu containing "advanced options". That took me a couple of minutes to find. – pdwalker Dec 16 '14 at 12:37
  • 1
    Why force someone to go offsite to gather all the information before being able to the answer? Hence the comment in case someone else makes the same assumption that the answer is here rather than here and there. – pdwalker Dec 19 '14 at 7:44
  • 1
    @jvriesem Actually, it does. My guess is you skipped step 2. – Daniel Beck May 5 '17 at 22:00


sudo dscl . change /users/$USER UserShell /bin/bash $(which zsh)
  • 3
    Can you explain why this answers the question? – ChrisF Nov 25 '12 at 10:55
  • Be sure to run this after brew install zsh. – mmell Mar 11 '14 at 16:04
  • 3
    Also, be careful that the path of zsh installed via homebrew is different. I do it as: sudo dscl . change /users/$USER UserShell /bin/bash $(which zsh) – metakermit Mar 25 '15 at 13:42
  • 1
    WARNING: This will break your shell if you copy / paste it without checking the path of zsh first. Do what metakermit said instead. – radixhound Apr 4 '16 at 13:51

If anyone wondering same problem happens on macOS Sierra and following command allowed me to change shell without problems:

chpass -s /usr/local/bin/zsh
  • 1
    This duplicates another answer and adds no new content. Please don't post an answer unless you actually have something new to contribute. "chfn and chsh are synonyms for chpass." – DavidPostill Dec 2 '16 at 12:16

Running this

sudo dscl . -create /Users/$USER UserShell /usr/local/bin/zsh

worked for me to fix

(eval):setopt:3: no such option: NO_warnnestedvar

which popped up everytime autocomplete should kick in

found in https://rick.cogley.info/post/use-homebrew-zsh-instead-of-the-osx-default/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.