我已经升级到 Ubuntu 18.04,并一直在尝试安装 zsh。我已经尝试了所有方法,并且是能够使用它,但是当我尝试安装时哦我的天啊,它开始运行然后出现错误:
Zsh not installed! Install zsh first.
我已经使用 cat 和所有工具来确认它确实已安装(显然,因为我正在使用它?)我做错了什么?
答案1
ohmyzsh
需要zsh
安装 shell。
该问题已详细解释这里。
一种解决方法是zsh
先安装,切换到 zsh shell,然后以ohmyzsh
之前相同的方式获取并运行。
使用示例wget
:
sudo apt install zsh
apt-get install git-core
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
ohmyzsh
将报告已成功安装,并输出以下内容或类似内容:
--2018-05-08 18:44:07-- https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh [following]
--2018-05-08 18:44:07-- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.44.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.44.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3941 (3.8K) [text/plain]
Saving to: ‘STDOUT’
- 100%[==========================================================>] 3.85K --.-KB/s in 0s
2018-05-08 18:44:07 (57.9 MB/s) - written to stdout [3941/3941]
Cloning Oh My Zsh...
Cloning into '/home/me/.oh-my-zsh'...
remote: Counting objects: 858, done.
remote: Compressing objects: 100% (721/721), done.
remote: Total 858 (delta 16), reused 780 (delta 10), pack-reused 0
Receiving objects: 100% (858/858), 572.49 KiB | 0 bytes/s, done.
Resolving deltas: 100% (16/16), done.
Checking connectivity... done.
Looking for an existing zsh config...
Using the Oh My Zsh template file and adding it to ~/.zshrc
I can't change your shell automatically because this system does not have chsh.
Please manually change your default shell to zsh!
__ __
____ / /_ ____ ___ __ __ ____ _____/ /_
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/ ....is now installed!
Please look over the ~/.zshrc file to select plugins, themes, and options.
如果你想更换 shell,可以通过发出以下命令来实现
chsh -s `which zsh`
sudo reboot
可能不需要重新启动,您可以注销然后重新登录。
要恢复默认 shell,只需发出命令
chsh -s /bin/bash
资料来源:
https://gist.github.com/tsabat/1498393
https://github.com/robbyrussell/oh-my-zsh/issues/227#issuecomment-825773
man chsh
答案2
这是我每次在物理/虚拟计算机上安装 ubuntu/debian 后设置 ZSH 所做的事情。
检查外壳
echo $0
- 安装 Git、cURL、wget 作为先决条件
sudo apt install curl git wget
- 安装 ZSH shell
sudo apt install zsh
- 更改默认 Shell
chsh -s $(which zsh)
---------------------->现在重新启动计算机(Linux)<------------------------
再次检查 Shell
echo $0
- 下载 Oh-My-ZSH
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- 下载ZSH 语法高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- 将其添加到 ~/.zshrc 文件中
显然在source $ZSH/oh-my-zsh.sh
部分之前
# default theme
# ZSH_THEME="robbyrussell"
ZSH_THEME="agnoster"
plugins=(
git
history
zsh-autosuggestions
zsh-syntax-highlighting
command-not-found
)
- (可选)下载 Power Level 10k 主题
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
- (如果你选择 9)转到 powerlevel10k 文件夹并运行此文件以自定义样式
p10k configure