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.
6 Answers
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.
-
4I installed a newer version of zsh with Homebrew, which put zsh in
/usr/local/bin/zsh. Unfortunately, chsh doesn't allow this, sayingchsh: /usr/local/bin/zsh: non-standard shell. Daniel Beck's answer is a suitable solution in this case. – adam_0 Feb 02 '13 at 19:20 -
43If you are getting problems with non-standard shells, I think you should be able to add
/usr/local/bin/zshto/etc/shellsand it should solve that problem. – Mike Meyers Feb 28 '13 at 10:57 -
13The 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 -
-
-
1@Awesome_girl By default,
/etc/shellsis owned, and only writable by, root (the superuser). You could, for example, usesudo vi /etc/shellsto usesudo(super user do) to run thevieditor 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 05 '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.
- Open "System Preferences" → "Users & Groups".
- Unless the lock icon is already unlocked, click the lock icon and authenticate yourself.
- 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).
- In context menu, choose "Advanced Options…".
- 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.
- 166
- 1
- 7
- 110,419
-
-
1Confirmed 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 02 '13 at 19:21
-
3
-
4right 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
-
@pdwalker Right, I wrote this answer on the assumption that you read the question (and clicked the link there, which describes how to do this except for the name of the preference pane). – Daniel Beck Dec 16 '14 at 15:30
-
1Why 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 07:44
-
Seems to be for an outdated version of OSX. El Capitan doesn't have the context menu. – jvriesem May 05 '17 at 21:58
-
1
-
1@DanielBeck: Sure enough! Thanks! I would have expected that the context menu would show regardless of authenticated status, but then that window would have a lock at the bottom. – jvriesem May 05 '17 at 22:10
-
-
Or:
sudo dscl . change /users/$USER UserShell /bin/bash $(which zsh)
- 257
- 2
- 9
- 131
- 1
- 2
-
3
-
-
3Also, 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 -
1WARNING: This will break your shell if you copy / paste it without checking the path of zsh first. Do what metakermit said instead. – radixhound Apr 04 '16 at 13:51
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.
- 21
-
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review – DarkDiamond Dec 12 '22 at 13:24
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
- 11
-
1This 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 02 '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/
- 241

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