How do I update zsh to the latest version?

TerminalZsh

Terminal Problem Overview


I recently switched to zsh on my Terminal.app on my OS X machine successfully. The version number of zsh is 4.3.11.

Terminal Solutions


Solution 1 - Terminal

If you're using oh-my-zsh

> Type omz update in the terminal

Note: upgrade_oh_my_zsh is deprecated

Solution 2 - Terminal

If you have Homebrew installed, you can do this.

# check the zsh info
brew info zsh

# install zsh
brew install --without-etcdir zsh

# add shell path
sudo vim /etc/shells

# add the following line into the very end of the file(/etc/shells)
/usr/local/bin/zsh

# change default shell
chsh -s /usr/local/bin/zsh

Hope it helps, thanks.

Solution 3 - Terminal

If you're not using Homebrew, this is what I just did on MAC OS X Lion (10.7.5):

  1. Get the latest version of the ZSH sourcecode

  2. Untar the download into its own directory then install: ./configure && make && make test && sudo make install

  3. This installs the the zsh binary at /usr/local/bin/zsh.

  4. You can now use the shell by loading up a new terminal and executing the binary directly, but you'll want to make it your default shell...

  5. To make it your default shell you must first edit /etc/shells and add the new path. Then you can either run chsh -s /usr/local/bin/zsh or go to System Preferences > Users & Groups > right click your user > Advanced Options... > and then change "Login shell".

  6. Load up a terminal and check you're now in the correct version with echo $ZSH_VERSION. (I wasn't at first, and it took me a while to figure out I'd configured iTerm to use a specific shell instead of the system default).

Solution 4 - Terminal

As far as I'm aware, you've got three options to install zsh on Mac OS X:

  • Pre-built binary. The only one I know of is the one that ships with OS X; this is probably what you're running now.
  • Use a package system (Ports, Homebrew).
  • Install from source. Last time I did this it wasn't too difficult (./configure, make, make install).

Solution 5 - Terminal

A simple script or execute following commands in terminal

# 1. download (currently the latest version is 5.8) and extract
wget https://sourceforge.net/projects/zsh/files/latest/download -O ./zsh-latest.tar.xz
mkdir zsh-latest
tar -xf zsh-latest.tar.xz -C zsh-latest --strip-components=1
cd zsh-latest

# 2. config, build, install
./configure
make -j4
sudo make install
which zsh

PS: If you fail to build, it probably due to missing necessary libraries. Just install libraries as the error message suggests. E.g, I didn't have ncurses:

sudo apt install ncurses-devel # for Ubuntu
sudo yum install ncurses-devel # for CentOS/Redhat

Solution 6 - Terminal

I just switched the main shell to zsh. It suppresses the warnings and it isn't too complicated.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCanView Question on Stackoverflow
Solution 1 - Terminalayush narulaView Answer on Stackoverflow
Solution 2 - TerminalMike LiView Answer on Stackoverflow
Solution 3 - TerminalaidanView Answer on Stackoverflow
Solution 4 - TerminalsimontView Answer on Stackoverflow
Solution 5 - TerminalHao LiuView Answer on Stackoverflow
Solution 6 - TerminaltheXView Answer on Stackoverflow