我最近在我的终端上切换到zsh。应用程序在我的OS X机器上成功。zsh的版本号为4.3.11。


当前回答

一个简单的脚本或在终端执行以下命令

# 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:如果构建失败,可能是因为缺少必要的库。只要按照错误消息的建议安装库即可。例:我没有ncurses:

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

其他回答

如果你在用oh-my-zsh

在终端中输入omz update

注意:upgrade_oh_my_zsh已弃用

我只是把主shell切换到zsh。它抑制了警告,并不太复杂。

一个简单的脚本或在终端执行以下命令

# 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:如果构建失败,可能是因为缺少必要的库。只要按照错误消息的建议安装库即可。例:我没有ncurses:

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

如果你没有使用Homebrew,这是我刚刚在MAC OS X Lion(10.7.5)上所做的:

Get the latest version of the ZSH sourcecode Untar the download into its own directory then install: ./configure && make && make test && sudo make install This installs the the zsh binary at /usr/local/bin/zsh. 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... 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". 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).

如果安装了Homebrew,就可以这样做。

# 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