How do I update zsh to the latest version?
Asked Answered
M

7

306

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

Middlebrooks answered 15/7, 2013 at 7:14 Comment(4)
FYI, zsh version 5.0.5 comes with Yosemite 10.10.2.Fortyfive
Run upgrade_oh_my_zsh in the terminalSensorium
Run omz update if ur partying like it's 2020...Instruction
oh-my-zsh != zsh...Hurds
C
192

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
Concoction answered 15/7, 2013 at 8:30 Comment(12)
Until recently, I'd Homebrew but I choose to uninstall it on purpose since it was messing with gem installations and it was really frustrating to find a workaround. Thanks anyway.Middlebrooks
@CanSürmeli Homebrew shouldn't mess with gem installations—I use both it and Rubygems all the time. Homebrew's very useful and it's worth fixing whatever problems you're having with it. That said, I don't know that I want to use it to replace Apple's zsh...Embryotomy
The directions here aren't replacing Apple's old zsh, but showing you how to make the new version available. The old one will still be available to use if necessary.Eastwards
Does anybody know what the --without-etcdir is for?Copperhead
@MikeLi and @PhillipMöhler what is the purpose of skipping /etc/zshrc? It seems like a strange thing to skip to me.Contributory
Be aware that you may need to install some softwares again (e.g. rbenv) after doing this.Fribble
I'd also love to know why this brew install zsh should be done --without-etcdirLemaster
I'm guessing the --without-etcdir has something to do with manually installing this... (editing /etc/shells to add the path to the brew installed zsh) - anyway, this option is no longer available.Lemaster
that option no longer seems to be necessary. My dotfiles repo's .zshrc file with zgen is working just fine following these commands. Although the option is no longer available, I think it's ok to attempt to use the option. It just ignores it.Lemaster
The option is no longer ignored, but throw an error and halt installation. The CLI flag semantics appear to have been reversed. Now you have the option to --enable-etcdir See: github.com/Homebrew/homebrew-core/blob/master/Formula/…Legendary
Did it exactly except I ran this instead: "brew install zsh" and nothing happens. "zsh --version" still gives 5.3 (default Mojave zsh version). Edit: nevermind a relaunch of the terminal window fixed it. If anyone wants to skip the trouble, just update to the latest Catalina, that comes with the latest 5.7.1 zsh.Kicksorter
I needed to use brew reinstall zsh instead as my mac has a zsh installed by default. Then I used zsh in the /opt/homebrew/bin/zsh instead of /usr/local/bin/zsh. And that worked as expected.Archiphoneme
A
1070

If you're using oh-my-zsh

Type omz update in the terminal

Note: upgrade_oh_my_zsh is deprecated

Antimony answered 1/11, 2013 at 11:59 Comment(2)
While this is not the actual answer to the OP, this is the answer to the question I meant to be searching for. Solved my problem.Alguire
upgrade_oh_my_zsh is deprecated, but it worked for me. and then I executed omz update which is the latest command to update. Hope this helps someone.Chloric
C
192

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
Concoction answered 15/7, 2013 at 8:30 Comment(12)
Until recently, I'd Homebrew but I choose to uninstall it on purpose since it was messing with gem installations and it was really frustrating to find a workaround. Thanks anyway.Middlebrooks
@CanSürmeli Homebrew shouldn't mess with gem installations—I use both it and Rubygems all the time. Homebrew's very useful and it's worth fixing whatever problems you're having with it. That said, I don't know that I want to use it to replace Apple's zsh...Embryotomy
The directions here aren't replacing Apple's old zsh, but showing you how to make the new version available. The old one will still be available to use if necessary.Eastwards
Does anybody know what the --without-etcdir is for?Copperhead
@MikeLi and @PhillipMöhler what is the purpose of skipping /etc/zshrc? It seems like a strange thing to skip to me.Contributory
Be aware that you may need to install some softwares again (e.g. rbenv) after doing this.Fribble
I'd also love to know why this brew install zsh should be done --without-etcdirLemaster
I'm guessing the --without-etcdir has something to do with manually installing this... (editing /etc/shells to add the path to the brew installed zsh) - anyway, this option is no longer available.Lemaster
that option no longer seems to be necessary. My dotfiles repo's .zshrc file with zgen is working just fine following these commands. Although the option is no longer available, I think it's ok to attempt to use the option. It just ignores it.Lemaster
The option is no longer ignored, but throw an error and halt installation. The CLI flag semantics appear to have been reversed. Now you have the option to --enable-etcdir See: github.com/Homebrew/homebrew-core/blob/master/Formula/…Legendary
Did it exactly except I ran this instead: "brew install zsh" and nothing happens. "zsh --version" still gives 5.3 (default Mojave zsh version). Edit: nevermind a relaunch of the terminal window fixed it. If anyone wants to skip the trouble, just update to the latest Catalina, that comes with the latest 5.7.1 zsh.Kicksorter
I needed to use brew reinstall zsh instead as my mac has a zsh installed by default. Then I used zsh in the /opt/homebrew/bin/zsh instead of /usr/local/bin/zsh. And that worked as expected.Archiphoneme
G
15

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).

Glaudia answered 16/9, 2013 at 2:1 Comment(0)
E
5

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).
Esdraelon answered 16/7, 2013 at 1:58 Comment(0)
V
3

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
Valenevalenka answered 10/11, 2021 at 9:43 Comment(0)
E
0

omz update gave me following error:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

This is an issue with git, where after upgrading to Mac OS Ventura (13.0.1). git command gave me above error.

Solution:

  • Download and install the 'Command Line Tools' package to fix 'git'
xcode-select --install

This will pop a dialogue box. Select "Install". More details here: https://apple.stackexchange.com/a/254381


omz update worked successfully after this for me

Exactly answered 27/12, 2022 at 19:46 Comment(0)
A
-2

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

Aga answered 2/6, 2020 at 17:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.