brew 无法安装iterm2_Oh My Zsh, 『 安装 & 配置 』

e871c09b64455a89738b1f85ac98935b.png

Oh My Zsh 是什么

  • Oh My Zsh 是一款社区驱动的命令行工具,正如它的主页上说的,Oh My Zsh 是一种生活方式。它基于 zsh 命令行,提供了主题配置,插件机制,已经内置的便捷操作。给我们一种全新的方式使用命令行。
  • Oh My Zsh 是基于 zsh 命令行的一个扩展工具集,提供了丰富的扩展功能。
  • 安装 Oh My Zsh 前提条件:必须已安装 zsh
  • 笔者是 Mac 系统,以下操作都是基于 Mac 系统。
Oh My Zsh - a delightful & open source framework for Z-Shell​ohmyz.sh
5f4d58e79d3037c2360f1b89ea8478a1.png
robbyrussell/oh-my-zsh​github.com
c0cfba46296273603b0f01272d5abe1e.png

Zsh 是什么

  • Zsh 是一款强大的虚拟终端,既是一个系统的虚拟终端,也可以作为一个脚本语言的交互解析器。
# 打开终端,在终端上输入: 
zsh --version

# 这个命令来查看我们的电脑上是否安装了 Zsh 
# 端查询版本为: zsh 5.8 (x86_64-apple-darwin20.0)
  • 终端查询版本为: zsh 5.7.1 (x86_64-apple-darwin18.2.0)
# 查看系统当前 shell
cat /etc/shells 

安装 Oh My Zsh 方法

  • 可以通过 curl 或 wget 两种方式来安装,用一条命令即可安装。

curl 安装

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

wget 安装

sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

安装过程中输出如下:

xxxx% sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 
Cloning Oh My Zsh...
Cloning into '/Users/xxxx/.oh-my-zsh'...
remote: Counting objects: 831, done.
remote: Compressing objects: 100% (700/700), done.
remote: Total 831 (delta 14), reused 775 (delta 10), pack-reused 0
Receiving objects: 100% (831/831), 567.67 KiB | 75.00 KiB/s, done.
Resolving deltas: 100% (14/14), done.
Looking for an existing zsh config...
Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh
Using the Oh My Zsh template file and adding it to ~/.zshrc
             __                                     __   
      ____  / /_     ____ ___  __  __   ____  _____/ /_  
     / __ / __    / __ `__ / / / /  /_  / / ___/ __  
    / /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / 
    ____/_/ /_/  /_/ /_/ /_/__, /    /___/____/_/ /_/  
                            /____/                       ....is now installed!
Please look over the ~/.zshrc file to select plugins, themes, and options.
p.s. Follow us at https://twitter.com/ohmyzsh.
p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.

设置主题

设置固定主题

  • 安装完毕后,我们就可以使用了,先来简单配置一下,Oh My Zsh 提供了很多主题风格,我们可以根据自己的喜好,设置主题风格
open ~/.zshrc

# 找到 ZSH_THEME
# robbyrussell 是默认的主题
ZSH_THEME="robbyrussell"

# ZSH_THEME="样式名称" 
  • 保存这个文件文件,重新打开终端。

设置随机主题

  • 我们还可以随机设置主题:
  • 步骤同上
ZSH_THEME="random"
  • 每次打开终端主题是随机的。
  • 终端输出:
[oh-my-zsh] Random theme '/Users/xxxx/.oh-my-zsh/themes/zhann.zsh-theme' loaded...
  • 其中 zhann.zsh-theme 是主题的名称, 有喜欢的童鞋可以记录保留.

查看主题名称

  • Oh My Zsh 默认自带了一些默认主题,存放在 ~/.oh-my-zsh/themes 目录中。我们可以查看这些主题
  • 终端输入:
cd ~/.oh-my-zsh/themes && ls
查看更多主题样式​github.com

卸载 Oh My Zsh

  • 终端输入 :
uninstall_oh_my_zsh
Are you sure you want to remove Oh My Zsh? [y/N]  Y
  • 终端提示信息:
Removing ~/.oh-my-zsh
Looking for original zsh config...
Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc
Found ~/.zshrc -- Renaming to ~/.zshrc.omz-uninstalled-20170820200007
Your original zsh config was restored. Please restart your session.
Thanks for trying out Oh My Zsh. It's been uninstalled.

Tips

  • Oh My Zsh 的自动更新提示误触关掉了解决办法
  • 打开终端输入:
upgrade_oh_my_zsh
  • 如果不喜欢系统自带终端,笔者推荐一个强大的终端 App。
  • iTerm2,非常好用的一个终端软件。
iTerm2 - macOS Terminal Replacement​iterm2.com
919fe306fd1ca2995301589dae6da75c.png

Oh My Zsh 443: Connection Refused 错误无法安装 :

Dream:Oh My Zsh 443: Connection Refused 错误无法安装​zhuanlan.zhihu.com
258088ffc12b32ddfd1b23db5e438473.png

Oh My Zsh 定制主题:

Dream:Oh My Zsh, 『 Powerlevel9k 安装 & 配置 』​zhuanlan.zhihu.com
78b57d30574da7c84dc26027b9a4e6a2.png
Dream:Oh My Zsh,『 Agnoster 主题配置 』​zhuanlan.zhihu.com
2a80763188c3e02fb5924df3a1a4f85a.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值