Skip to content

[MacOS] How To Change Default Scripting Language Zsh To Bash

Last Updated on 2021-10-09 by Clay

When you started using Mac OS in first time, you would find the default scripting language in terminal is Zsh instead of Bash. If you want to change this situation, I can help.

I am more familiar with bash, so I have more scripts wrote by bash, even if zsh and bash are both scripting languages, there is no guarantee that zsh can execute my old scripts.

So, let's introduce how to change the zsh to bash in the Mac OS terminal! But first, I want to introduce what is the scripting language.


What is the scripting language?

Scripting Language is an interpreted programming language.

The following content is excerpted from Wikipedia.

scripting language or script language is a programming language for a runtime system that automates the execution of tasks that would otherwise be performed individually by a human operator.[1] Scripting languages are usually interpreted at runtime rather than compiled.
A scripting language's primitives are usually elementary tasks or API calls[clarification needed], and the scripting language allows them to be combined into more programs. Environments that can be automated through scripting include application softwaretext editorsweb pagesoperating system shellsembedded systems, and computer games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, it is also known as an extension language. Scripting languages are also sometimes referred to as very high-level programming languages, as they sometimes operate at a high level of abstraction, or as control languages, particularly for job control languages on mainframes.

Change scripting language via terminal

First, we can check which scripting languages are supported in the system.

cat /etc/shells


Output:

# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh


It can be found that there are actually many options besides bash.

Then, if we change zsh to bash, we can use the chsh command.

chsh -s /bin/bash

We can see that the original terminal displays zsh:

After reopening, it will be displayed as bash.

Of course, in addition to operating in the terminal, we can also replace bash in the setting interface.


Use the system preferences to change the scripting language

click apple icon in the upper right corner > System Preferences > Users & Groups > Click the lock to make changes > Right click on the account > Advances Options > switch login shell

This way can also switch the default scripting language.

The above is a simple tutorial about how to change zsh to bash in terminal on Mac OS.


References


Read More

Tags:

2 thoughts on “[MacOS] How To Change Default Scripting Language Zsh To Bash”

Leave a ReplyCancel reply

Exit mobile version