If you do any kind of development on Linux or a Mac you know how important and useful the terminal (Unix) shell is. If you are new to it all here’s a quick refresher on Terminals/Shells/Command Lines.
The standard and most popular Unix shell for years was the Bash shell. Over time the Z shell (zsh) which is an extended Bourne shell with enhanced features replaced the bash shell in popularity and in 2019 Mac OS Catalina made zsh the default login shell replacing bash.
If you are on an updated version of the Mac OS then, zsh should already be installed and your default login shell. You can check what is the default shell on your Mac by launching the Terminal app from the Launcher and in the terminal enter
echo $0 or echo $SHELL
If it says -zsh or /bin/zsh you can verify the version by entering the following in the terminal window
zsh --version
If you don’t have it installed or need to update the version, use the popular and our favorite package manager Homebrew to install it. If you don’t have brew installed follow the instructions here to install it first. Once you have brew installed, from the terminal app enter the following commands to first update brew and then install zsh
brew update
brew install zsh
If you are on the older Mac OS and zsh
sudo sh -c "echo $(which zsh) >> /etc/shells" && chsh -s $(which zsh)
If you are on a Linux system, the process is similar. Most of the newer Linux distributions have zsh as the default shell but if you are on an older OS, you can check is zsh is installed and it’s version by entering zsh –version in your Linux terminal. If you need to install or update zsh, the commands are slightly different based on the flavor of your Linux OS and the package manager installed. On Debian based systems (like Ubuntu) enter the following commands in the terminal shell
sudo apt update
sudo apt upgrade
sudo apt install zsh
On Redhat based systems (like Centos) enter the following commands in the terminal shell
sudo yum upgrade
sudo yum install zsh
On SuSe based systems enter the following commands in the terminal shell
sudo zypper upgrade
sudo zypper install zsh
To make zsh your default shell on Linux systems, after you have installed zsh enter the following in the terminal shell
sudo vi /etc/passwd
Find the line with your username:
username:x:1634231:100:Your Name:/home/username:/bin/bash
and replace bash with zsh
username:x:1634231:100:Your Name:/home/username:/bin/zsh
Log out and log in back for the changes to take effect.
Finally after your have zsh as your default shell, on Mac or Linux install the Oh My Zsh package. As their website so eloquently states…
Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration. It comes bundled with thousands of helpful functions, helpers, plugins, themes, and a few things that make you shout…
“Oh My ZSH!”
You can browse their site Oh My Zsh
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
$ sh -c “$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”