Zsh contains many of the same features that Bash does since it is built on the same shell, and moving over to it is a simple process. Actually, if you have macOS Catalina beta or later, your Mac already uses zsh as the default shell in Terminal, thus you won’t need to transition.
However, for those who still have Bash on their Macs, we will present today multiple ways to install and use zsh as well as Oh My Zsh on Mac.
What Is the Difference Between Bash and Zsh on Mac?
Bash is a command-line interface shell application that is used to a great extent in both Linux and macOS. When a user wants to operate their computer without having to navigate the menus and windows included inside a GUI, they will utilize Bash.
Zsh, commonly known as the Z shell, is an enhanced version of the Bourne Shell (sh). Which includes support for plugins and themes in addition to a plethora of brand-new features. It is both more interactive and more configurable than bash.
Unlike bash, zsh has support for floating-point numbers, offers spelling correction and approximate completion, provides support for hash data structures, and way more. And like we said, starting with macOS Catalina, it is the default terminal shell. You can check which terminal shell you have by typing the
echo $0 command.
What Is the Difference Between macOS Zsh and Oh My Zsh?
Zsh is a type of Unix shell that may serve both as an interactive login shell and as a command interpreter for shell scripting. On the other hand, Oh My Zsh is an open-source platform for managing your zsh setup.
It comes pre-loaded with a variety of enhancements to the zsh shell, such as functions, themes, and plugins. Oh My Zsh is by far the most popular and user-friendly zsh framework available, and we’ll show you how to install and use it on your Mac.
How to Install Zsh and Oh My Zsh on Mac
Install Zsh on Mac
- Before installing zsh on your Mac, you need to determine whether or not Homebrew is already present on your device. First, open the Terminal by going to Launchpad and typing Terminal. Then enter the command brew. The following notice will appear in the event that Homebrew is not present.
- To install Homebrew, you can check our dedicated guide. Or paste the following command and enter your password:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- To install zsh simply paste the following command:
brew install zsh
Homebrew is a free software package management system that operates on macOS. It is praised by many Mac users as an excellent package manager because of its user-friendliness and efficiency in reducing the amount of time and effort required by users.
Regardless of which Unix shell you decide to use on your Mac, it is strongly recommended that you acquire at least a fundamental understanding of how to operate the terminal.
Install Oh My Zsh on Mac
Time needed: 4 minutes
- Open the Terminal on your Mac by going to Launchpad and typing Terminal.
- Paste the following command to install Oh My Zsh: sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
- If you get the following error: git clone of oh-my-zsh repo failed, then click the Install button on the new window to install the command line developer tools.
- Wait until the installation process is done, then paste the Oh My Zsh installation command into the Terminal: sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
How Do I Set Oh My Zsh as My Default Mac Terminal?
Zsh ought to be configured as your default shell by the installation script, but in the event that it isn’t, you may do it manually as follows:
- Open your Terminal by going to Launchpad and typing Terminal.
- Paste the following command to make ZSH your default:
chsh -s $(which zsh)
How Do You Use Oh My Zsh After Installing?
After installing Oh My Zsh you can do the following:
- Get a short overview of the Built-in plugins.
- Have a look at their Plugins and Themes.
- You can check the External themes and External plugins if you feel like you need extra features. Keep in mind that they aren’t reviewed.
- Check out the Cheatsheet if you want to learn more about Oh My Zsh tips and techniques.
How Do I Add Plugins to Oh My Zsh?
Enabling the plugins that come pre-installed with Oh My Zsh allows you to take benefit of the functionality they provide for your shell in a variety of different forms. They are individually documented in the README file that can be found in the plugins folder that corresponds to them.
You may include plugins into your shell by writing the plugin’s name in the array of plugins located in the .zshrc file found in the $HOME directory. For example, this enables the macos, pod, and forklift plugins in this specific order:
plugins=(macos pod forklift)
Be aware that installing plugins may result in a longer time required for the shell to start up. In order to add External plugins, the method might be slightly different. We recommend that you check the linked Git page.
How Do I Install Oh My Zsh Themes on Mac?
Edit your .zshrc file (found in the $HOME directory) and change the value of ZSH_THEME to the name of the theme you want to use. For example:
ZSH_THEME=robbyrussell. If you do not want any theme to be active, set ZSH_THEME to an empty string:
You can find out all there is to know about Oh My Zsh by visiting their GitHub wiki page, which has further links and information to literally anything you could need.
For more related information, we recommend that you take a look at our article on Mac terminal commands you need to know to master the useful tool. Don’t forget to leave a comment in the section below and tell us what you think.