You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Change default shell to zsh

Just upgraded from Mojave (not before time!) to Monterey. Used to use bash. Users&groups says I'm using zsh. But when I start a terminal window I'm in bash, and when I type chsh -s /bin/zsh it doesn't do a thing; just goes on using bash.


I'm reading https://code2care.org/zsh/zsh-shell-mac-tutorial


Should I just mv .bashrc to .zshrc (there's nothing much in it anyway), and maybe .bash_profile to .zshprofile? (or copy them over?) That page offers no guidance.


Does it matter? Probably not much, I don't make that much use of the terminal window.

MacBook Air 13″, macOS 12.6

Posted on Jan 8, 2023 11:50 AM

Reply

Similar questions

10 replies

Jan 9, 2023 5:32 PM in response to ksmithcamp

Terminal Preferences are not required to set the default shell. Actually, it doesn't set the default shell, just the one you use for that session.

If the change shell command didn't work, something is blocking it. You could try setting the default shell in your user account. Users & Groups System Settings > Ctrl-click on user and select Advanced Options…

You can select the default shell from there.

Jan 9, 2023 6:36 PM in response to Barney-15E

Actually, this does work (opening terminal preferences and changing the login shell to "default". Recall that my system preferences Users&Groups already thought that was the default. But my terminal preferences didn't get the message; it still thought I wanted to use /bin/bash, which I must have set back in some former life.) Subsequent terminal windows are now opening in zsh.

Jan 10, 2023 6:44 AM in response to ksmithcamp

The correct syntax to switch to the Zsh shell from your original Bash shell is in the Terminal. Your admin password is required for the following and nothing will echo at the password prompt.


sudo /usr/bin/chsh -s /bin/zsh


Do not add zsh in the Terminal preferences as the Terminal knows what shell to run from the $SHELL environment variable.


Although some Bash syntax works in Zsh, the Terminal prompt codes are different and the dotfiles have differences too, so resist copying your Bash dot files to Zsh dot files. All you really need is a $HOME/.zshrc dot file and Zsh is a happy camper.


Here is a Zsh HERE document that when copy/pasted into the Terminal will write a new $HOME/.zshrc file for you with a basic PATH and Terminal prompt. Press return after you paste it.


<<"EOF" > ~/.zshrc
export PATH=".:${PATH}"
PS1="%m: %~ %% "
EOF


At the new Terminal prompt after this script finishes, type the following:


source ~/.zshrc


and your PATH and Terminal prompt are set, and will be set each time you launch the Terminal.


Zsh is a large and powerful shell. In addition to the online documentation manual, there are UNIX man pages available via:


man zsh
man zshall



Change default shell to zsh

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.