Z shell install on any Linux / Windows / Mac

z-shell-install-thumb

Check if zsh is preloaded

Zsh was designed to be interactive and it incorporates many features of other Linux GNU/ Unix shells such as bash, tcsh, and ksh. It is also a powerful scripting language just like the other shells available. Some Linux systems come preloaded with zsh so it isn’t required to install z shell but rather just invoke/activate it. 

  1. Open your default terminal interface.
  2. zsh –version
  3. In case this returns a zsh version which is alright for you, you’re done now!

Installing zsh on Linux

Determine the distro of Linux that your system is based on. 

See the List of Linux distributions for a list. 
(Most Linux systems like the Ubuntu OS are forked from and based on the 
Debian-architecture.)

Debian-based Linux systems

Open a terminal window. Copy & paste the commands in the code area below this paragraph into the terminal window and hit Enter. You may be prompted to enter your password.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install zsh

[the_ad id=”436″]

Fedora-based Linux systems

Open a terminal window. Copy & paste the commands in the code area below this paragraph into the terminal window and hit Enter. You may be prompted to enter your password.

sudo dnf update
sudo dnf upgrade
sudo dnf install zsh

CentOS/Red Hat-based Linux systems

Open a terminal. Copy & paste the commands in the code area below this paragraph into the terminal window and hit Enter. You may be prompted to enter your password.

sudo yum upgrade
sudo yum install zsh

Suse-based Linux systems

Open a terminal. Copy & paste the commands in the code area below this paragraph into the terminal window and hit Enter. You may be prompted to enter your password.

sudo zypper upgrade
sudo zypper install zsh

Arch-based Linux systems

Open a terminal. Copy & paste the commands in the code area below this paragraph into the terminal window and hit Enter. You may be prompted to enter your password.

sudo pacman -S zsh

Installing zsh on a Mac

If you want the latest and greatest version of zsh in the Mac ecosystem, use the Homebrew service: Proceed with the following steps to install a recent version.

Step 1 – Install Homebrew

Homebrew simplifies the installation of most terminal based programs and softwares in the Mac OS and all other Mac installations .

Copy & paste the commands in the code area below this paragraph into the terminal window and hit Enter.

ruby -e "$(curl -fsSL https://raw.zshhubusercontent.com/Homebrew/install/master/install)"
brew doctor

You will be requested to install the Command Line Developer Tools from Apple to continue. Confirm by clicking the Install button in the alert that pops up. After the of installation of Command Line Developer Tools is done, continue with the installation of Homebrew by hitting Enter again.

Step 2 – Install zsh

Copy & paste the commands in the code area below this paragraph into the terminal window and hit Enter.

brew install zsh

Optional Step 3 – set as default shell

This is optional but to directly call the z shell on terminal initiation you’ll need to set zsh as your default shell. Copy & paste the commands in the code area below this paragraph into the terminal window and hit Enter to get that done.

sudo -s 'echo /usr/local/bin/zsh >> /etc/shells' 
chsh -s /usr/local/bin/zsh

z shell install on Windows

thumb_bash-for-windows
  1. Setup bash for windows using the link above
  2. To install Zsh on Windows’ Ubuntu, open the Bash shell and run the following command
    sudo apt-get install zsh
  3. When prompted type “y”, and then press Enter to continue. Apt-get will then automatically downloads and installs Zsh from Ubuntu’s repositories.
  4. Run zsh to start the z-shell terminal instance.
  5. To make Bash Automatically Launch Zsh
    1. Edit the “.bashrc” file using the below command
      nano .bashrc
    2. Add the following lines to the file.
      #Launch Zsh
      if [ -t 1 ]; then
      exec zsh
      fi
      You could also simply add the “exec zsh” line, however the following additional lines ensures that the kernel only launches Zsh when you open the Bash Terminal window. Thus avoiding problems for any other software.

      install-z-bash-bashrc modify
    3. Hold Ctrl+O till a message appears asking to save at the upper portion of the bottom menu-bar and press Enter to save the file.
    4. Press Ctrl+X to exit nano afterward.
    5. Restart the Ubuntu shortcut (or other Linux distribution shortcut) on Windows, it starts up with the Zsh shell.

You have completed the z shell install.

You can also check out other popular and feature-rich terminal shells for Unix here:

linux-shells-compared

1 thought on “Z shell install on any Linux / Windows / Mac”

  1. Hello There. I found your blog using msn. This is a very well written article.
    I will be sure to bookmark it and come back to read more of
    your useful information. Thanks for the post.

    I’ll definitely return.

Leave a Reply

Your email address will not be published. Required fields are marked *