[Mac] 打造美觀又潮的終端機:iTerm + Oh My Zsh + Agnoster + Powerline
只要是在 Mac 環境下工作的工程師
一定會使用到 Terminal
但內建的實在太醜、完全沒有 highlight
加上沒分頁,用起來實在很不方便
看起來不夠宅不夠專業
所以趕快來把你的 Terminal 用潮一點吧!
Overview
1. Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. Install iTerm
brew cask install iTerm2
brew install caskroom/cask/iterm2
brew install caskroom/versions/iterm2-legacy
brew install caskroom/versions/iterm2-nightly
3. Install Oh My Zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
4.Set zsh theme to agnoster
edit ~/.zshrc file
and set ZSH_THEME="agnoster"
5. Install Powerline Fonts
git clone https://github.com/powerline/fonts.git
./install.sh
cd fonts
rm -rf fonts
cd ..
6.Remove device name & user name
edit ~/.zshrc file and add
export DEFAULT_USER=whoami
1. Install Homebrew
Homebrew 是在 Mac 下一個很方便的套件安裝工具
基本上會使用 Terminal 工作的朋友一定會裝,就不用多說了
直接貼上以下語法安裝即可
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. Install iTerm2
接下來是安裝 iTerm2
brew cask install iTerm2
不過因為有很多種版本,所以要選擇一個
沒特別需求就第一種吧!
brew install caskroom/cask/iterm2
brew install caskroom/versions/iterm2-legacy
brew install caskroom/versions/iterm2-nightly**
3. Install Oh My Zsh
直接貼上以下語法來安裝 Oh My Zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
4.Set zsh theme to agnoster
使用 Oh My Zsh 最基本的美化 Theme 就是 Agnoster
用你習慣的編輯器打開 zshrc 這個檔案後
把 ZSH_THEHE 改成 agnoster 即可
edit ~/.zshrc file
and set ZSH_THEME="agnoster"
5. Install Powerline Fonts
不過套用 Theme 了會發現反而出現一堆亂碼
這是因為你目前使用的字型沒有支援這些特殊符號
直接透過指令來安裝 Powerline 字型吧!
git clone https://github.com/powerline/fonts.git
cd fonts
./install.sh
rm -rf fonts
安裝完成後,還要到 iTerm 的 Preference => Profiles => Text 下去設定字型
字型名稱會有 Powerline 的關鍵字
比方說 Roboto Mono for Powerline
不過預設的顏色通常會太鮮豔
可以到 Preference =>Profiles => Colors 再做調整
有一些預設的顏色組合可以直接套用
6.Remove device name & user name
最後是前面一長串電腦名稱 + 使用者名稱太多餘
我們再打開 zshrc 檔加入 export DEFAULT_USER 來過濾掉
edit ~/.zshrc file and add
export DEFAULT_USER=whoami
或是貼上下列語法
prompt_context() { if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then prompt_segment black default "" fi }
歡迎您留言與分享!(Welcome for comments or sharing!)
- [Unity] Decompile Dll:ILSpy for Mac
- [App] Sdorica 遊戲攻略影片