I can't seem to switch to zsh

I keep getting the message below when I run ./o.sh from my terminal. I have run the update, it says no changes are made. I tried lookin go the option to change via System Preferences, but can't find it.


Am totally confused as to what I need to do. Do I have to change the extension of my sh file?


The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ 
bash-3.2$ exit

MacBook Pro 16″, macOS 11.4

Posted on Jun 20, 2021 12:08 PM

Reply
Question marked as Top-ranking reply

Posted on Jun 20, 2021 1:07 PM

Run this command in the Terminal:

sudo chsh -s /bin/zsh


Enter your admin password at the prompt. It will not echo any characters. Press return.


The Zsh shell does not read any of your Bash dot startup files, and needs its own to set the path and a different prompt syntax:


Copy and paste the following into a text editor as plain text and save it in your home directory as .zshrc — the leading dot is very important, as it will be a hidden file from the Finder and Terminal, but Zsh is looking for that particular file.


# .zshrc

export PATH="$HOME:/usr/local/bin:${PATH}"
# Zsh shell prompt %m - hostname %~ - current directory %% - prompt character
PS1="%m: %~ %% "



You can then do the following to make these settings current in the present Terminal session:


source ~/.zshrc


and each time you launch the Terminal with the Zsh shell, it will run the contents of the .zshrc file.


The current manual for the Zsh shell is here. You can also get help in the Terminal via:


man zsh


7 replies
Question marked as Top-ranking reply

Jun 20, 2021 1:07 PM in response to SergioQ

Run this command in the Terminal:

sudo chsh -s /bin/zsh


Enter your admin password at the prompt. It will not echo any characters. Press return.


The Zsh shell does not read any of your Bash dot startup files, and needs its own to set the path and a different prompt syntax:


Copy and paste the following into a text editor as plain text and save it in your home directory as .zshrc — the leading dot is very important, as it will be a hidden file from the Finder and Terminal, but Zsh is looking for that particular file.


# .zshrc

export PATH="$HOME:/usr/local/bin:${PATH}"
# Zsh shell prompt %m - hostname %~ - current directory %% - prompt character
PS1="%m: %~ %% "



You can then do the following to make these settings current in the present Terminal session:


source ~/.zshrc


and each time you launch the Terminal with the Zsh shell, it will run the contents of the .zshrc file.


The current manual for the Zsh shell is here. You can also get help in the Terminal via:


man zsh


Jun 23, 2021 1:00 PM in response to SergioQ

The first thing you should try is to change the first line in your o.sh file to the following:


#!/bin/zsh


Then make it executable if it is not already, and run it.


chmod +x o.sh
./o.sh


What breaks when you run it? Many Bash shell constructs work the same in Zsh and some do not. We are flying blind without you posting the contents of o.sh here.


Click the <> code insertion button on the bottom toolbar, click in its light gray insertion field (as I did above) in this editor, and copy/paste the o.sh source. Press a return at the end of your code, and then click the <> button again to stop code insertion.

Jun 22, 2021 9:53 PM in response to SergioQ

SergioQ wrote:

I keep getting the message below when I run ./o.sh from my terminal. I have run the update, it says no changes are made. I tried lookin go the option to change via System Preferences, but can't find it.

Am totally confused as to what I need to do. Do I have to change the extension of my sh file?

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ 
bash-3.2$ exit




How did this go for you SergioQ are you up and running your zsh ...?


To see you current shell:

 echo $SHELL


hot link to man zsh, if you copy & paste into Safari or save locally :

x-man-page://zsh

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

I can't seem to switch to zsh

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