Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switching from zsh to bash on OS X, and back again?

Tags:

bash

terminal

zsh

People also ask

How do I exit zsh in Terminal?

Pressing Enter on an empty line: execute: _ zsh: do you wish to see all 373 possibilities (64 lines)? In other shells, Alt + X brings the same behavior, except that Ctrl + C cancels the prompt.

Why did macOS switch from bash to zsh?

One of the primary reasons why Apple switched to zsh is because it is closer to the functionality of the standard bash. If you are familiar with the standard bash, you will be glad to know that there is an Apple ZSH prompts which looks similar to the one you will find in Microsoft Outlook.

How do I change my default shell from zsh to bash?

Change the shell for your user in a terminal applicationEnable the Run a custom command instead of my shell option, then in the Custom command field enter the full path to the shell you want to use, e.g. /bin/zsh , /bin/bash , etc.

Can I use both bash and zsh?

Zsh's syntax is not completely compatible with bash, but it's close. A lot of code will keep working, for example typical aliases and functions.


You can just use exec to replace your current shell with a new shell:

Switch to bash:

exec bash

Switch to zsh:

exec zsh

This won't affect new terminal windows or anything, but it's convenient.


you can try chsh -s /bin/bash to set the bash as the default, or chsh -s /bin/zsh to set the zsh as the default.

Terminal will need a restart to take effect.


I switch between zsh and bash somewhat frequently. For a while, I used to have to source my bash_profile every switch. Then I found out you can (typically) do

exec bash --login

or just

exec bash -l

if it is just a temporary switch

you can use exec as mentioned above, but for more of a permanent solution.

you can use chsh -s /bin/bash (to switch to bash) and chsh -s /bin/zsh (to switch to zsh)


For Bash, try

chsh -s $(which bash)

For zsh, try

chsh -s $(which zsh)