103

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.

kenorb
  • 26,615
Idlecool
  • 1,458
  • 2
  • 15
  • 15

6 Answers6

121

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.

kenorb
  • 26,615
Spiff
  • 110,156
64

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

Qsigma
  • 166
Daniel Beck
  • 111,893
13

Or:

sudo dscl . change /users/$USER UserShell /bin/bash $(which zsh)
frank
  • 131
2

An update, on Ventura, you can either use dscl as people have described above, or go into the system settings and control click (or right click) on your user name. You will then be able to choose advanced options and from there add your shell as the login shell. But be careful so that you do not break anything.

Jezuz
  • 21
1

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
0

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/

Can Rau
  • 261
  • 2
  • 5