1. 安裝iTerm2
iTerm2 是一款完全免費(fèi)的,專為 Mac OS 用戶打造的命令行應(yīng)用。直接在官網(wǎng)上http://iterm2.com/ 下載并安裝即可。
也可以通過Homebrew來安裝:
$ brew cask install iterm2
2. 配置 Oh My Zsh
(1)設(shè)置ITerm為默認(rèn)終端
$ chsh -s /bin/zsh // 一般需要輸入電腦開機(jī)密碼
(2)Oh My Zsh 是對主題的進(jìn)一步擴(kuò)展,地址:https://github.com/robbyrusse...
使用curl安裝:
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
3. 配置配色
我用到了pip工具,沒有的話可以這樣安裝
$ sudo easy_install pip
(1)安裝powerline
$ pip install powerline-status --user
(2)下載字體和配色
$ mkdir ~/Desktop/OpenSource/
$ cd ~/Desktop/OpenSource/
$ git clone [https://github.com/powerline/fonts.git](https://github.com/powerline/fonts.git) --depth=1
$ cd fonts
$ ./install.sh
$ cd ~/Desktop/OpenSource
$ git clone [https://github.com/altercation/solarized](https://github.com/altercation/solarized)
$ cd solarized/iterm2-colors-solarized/
$ open .
在打開的finder窗口中,雙擊Solarized Dark.itermcolors和Solarized Light.itermcolors即可安裝明暗兩種配色。
4. 安裝主題
$ cd ~/Desktop/OpenSource/
$ git clone [https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor.git](https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor.git)
$ cd oh-my-zsh-agnoster-fcamblor/
$ ./install
$ vi ~/.zshrc
vim 編輯文件 修改主題
ZSH_THEME="agnoster"
執(zhí)行下面命令
$ source ~/.zshrc
重啟iTem就好了。
5. 修改字體
按照上面配置好后,發(fā)現(xiàn)提示符并不是好看的箭頭,而是小問號,這個時候,檢查一下字體配置。
iterm2->Preference->Profile->Text->Non-ASCII Font
這個里面,應(yīng)該選擇“……for powerline”之類的字體,可以看到終端的提示符立刻變美了~
參考資料:Mac/Linux下配置iTerm2+zsh+powerline美化終端窗口[https://www.xiebruce.top/590.html]