到 iTerm2 官网 下载 ,解压后将 iTerm 移动到“应用程序”目录下即可,老规矩,第一打开使用右键“打开”。
根据官网 https://ohmyz.sh/#install 的说明,无论使用以下哪条命令均会报错
1demo1984s@MacBook-Pro ~ % sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
2curl: (7) Failed to connect to raw.github.com port 443: Connection refused
3demo1984s@MacBook-Pro ~ %
猜测是被墙了的原因,将 url 替换成 https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh
1Looking for an existing zsh config...
2Using the Oh My Zsh template file and adding it to ~/.zshrc.
3
4 __ __
5 ____ / /_ ____ ___ __ __ ____ _____/ /_
6 / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
7/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
8\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
9 /____/ ....is now installed!
10Before you scream Oh My Zsh! please look over the ~/.zshrc file to select plugins, themes, and options.
11• Follow us on Twitter: https://twitter.com/ohmyzsh
12• Join our Discord server: https://discord.gg/ohmyzsh
13• Get stickers, shirts, coffee mugs and other swag: https://shop.planetargon.com/collections/oh-my-zsh
14➜ scripts
安装成功,敲入 exit
回车退出。
在目录 ~/.oh-my-zsh/themes/
有不少主题可供选择,这里我们选择 agnoster.zsh-theme
这个主题,注释掉默认主题“robbyrussell”,修改为“agnoster”
1demo1984s@MacBook-Pro ~ % vi vi ~/.zshrc
1# If you come from bash you might have to change your $PATH.
2# export PATH=$HOME/bin:/usr/local/bin:$PATH
3
4# Path to your oh-my-zsh installation.
5export ZSH="/Users/tangjun/.oh-my-zsh"
6
7# Set name of the theme to load --- if set to "random", it will
8# load a random theme each time oh-my-zsh is loaded, in which case,
9# to know which specific one was loaded, run: echo $RANDOM_THEME
10# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
11# ZSH_THEME="robbyrussell"
12ZSH_THEME="agnoster"
官网安装说明: https://powerline.readthedocs.io/en/latest/installation.html ,执行安装命令的时候如果提示找不到 pip
则需要先安装 pip
1demo1984s@MacBook-Pro ~ pip install powerline-status
2zsh: command not found: pip
3 ✘ demo1984s@MacBook-Pro ~ sudo easy_install pip
4Searching for pip
5Reading https://pypi.org/simple/pip/
6Downloading https://files.pythonhosted.org/packages/54/eb/4a3642e971f404d69d4f6fa3885559d67562801b99d7592487f1ecc4e017/pip-20.3.3-py2.py3-none-any.whl#sha256=fab098c8a1758295dd9f57413c199f23571e8fde6cc39c22c78c961b4ac6286d
7
8Best match: pip 20.3.3
9Processing pip-20.3.3-py2.py3-none-any.whl
10Installing pip-20.3.3-py2.py3-none-any.whl to /Library/Python/2.7/site-packages
11Adding pip 20.3.3 to easy-install.pth file
12Installing pip script to /usr/local/bin
13Installing pip3.8 script to /usr/local/bin
14Installing pip3 script to /usr/local/bin
15
16Installed /Library/Python/2.7/site-packages/pip-20.3.3-py2.7.egg
17Processing dependencies for pip
18Finished processing dependencies for pip
再次安装 Powerline
1bash
2demo1984s@MacBook-Pro ~ pip install powerline-status
3DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
4Defaulting to user installation because normal site-packages is not writeable
5Collecting powerline-status
6 Downloading powerline-status-2.7.tar.gz (233 kB)
7 |████████████████████████████████| 233 kB 74 kB/s
8Building wheels for collected packages: powerline-status
9 Building wheel for powerline-status (setup.py) ... done
10 Created wheel for powerline-status: filename=powerline_status-2.7-py2-none-any.whl size=258577 sha256=7e50cb4e1b61f40ab6ba0d63c9b03a421098b6a7af2ade6b7aafb5709cd5337b
11 Stored in directory: /Users/demo1984s/Library/Caches/pip/wheels/f7/f4/a2/46d8b8b875843df5ee1bdf538aae445f6c16cb354e05a1f4ae
12Successfully built powerline-status
13Installing collected packages: powerline-status
14Successfully installed powerline-status-2.7
将字体库下载到本地
1git clone https://github.com/powerline/fonts.git --depth=1 ~/.PowerFonts
2Cloning into '~/.PowerFonts'...
3remote: Enumerating objects: 310, done.
4remote: Counting objects: 100% (310/310), done.
5remote: Compressing objects: 100% (236/236), done.
6remote: Total 310 (delta 75), reused 260 (delta 71), pack-reused 0
7Receiving objects: 100% (310/310), 10.40 MiB | 25.00 KiB/s, done.
8Resolving deltas: 100% (75/75), done.
在 iTerm2 -> Preferences -> Profiles -> Text
设置 Font
为 Meslo LG M for Powerline
。
官网 https://iterm2colorschemes.com 下载龟速,换一种方式,将 Git 仓库拷贝到本地
1git clone https://github.com/mbadolato/iTerm2-Color-Schemes ~/.iTerm2-Color-Schemes
2