New terminal: iterm2
iTerm2 + zsh to beautify the terminal
I’m writing to introduce two lovely apps to make our terminal more convenient and comfortable.
Here are the leading roles:
Xcode
The iterm2 need to be installed by homebrew, and before that we have to install the Xcode or Xcode command line tools first. For installing Xcode command line tools run:
$ xcode-select --installHomebrew
Homebrew is a free and open-source software package management system. To know more commands please click another blog post Homebrew of mine.
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"- Homebrew
// change to ustc $ cd "$(brew --repo)" $ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git // reset to origin $ cd "$(brew --repo)" $ git remote set-url origin https://github.com/Homebrew/brew.git - Homebrew Bottles
// bash: $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile $ source ~/.bash_profile // zsh: $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc $ source ~/.zshrc - Homebrew Core
// change to ustc $ cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-core $ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git // reset to origin $ cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-core $ git remote set-url origin https://github.com/Homebrew/homebrew-core - Homebrew Cask
// change to ustc $ cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask $ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git // reset to origin $ cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask $ git remote set-url origin https://github.com/Homebrew/homebrew-cask
iTerm2
iTerm2 is an open source replacement for Apple’s Terminal. It’s highly customizable and comes with a lot of useful features.
$ brew cask install iterm2Zsh & oh-my-zsh
The Z shell (also known as zsh) is a Unix shell that is built on top of bash (the default shell for macOS) with additional features.
// install
$ brew install zsh
// change default terminal from bash to zsh
$ chsh -s /bin/zsh
// install oh-my-zsh
$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"-
Two practical scripts:
syntax highlighting&zsh-autosuggestions// syntax highlighting $ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting $ echo "source \$ZSH_CUSTOM/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc // zsh-autosuggestions $ git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions -
Install a theme. For example,
-
Find and download the theme agnoster in Github
-
Run
installscript to copy theme to your ~/.oh-my-zsh folder
Set parameter in ~/.zshrc
$ vim ~/.zshrc// set theme name
ZSH_THEME="agnoster"
// plugins
plugins=(git pip python brew osx zsh-syntax-highlighting zsh-autosuggestions)
// export ./bash_profile to merge together
source ~/.bash_profileFinally run ~/.zshrc to reactive those changes
$ source ~/.zshrcThe end 😊
Reference
- 如何给码农👨💻的Mac开光 (some useful details
and some bugs) - iTerm 2 && Oh My Zsh【DIY教程——亲身体验过程】 (some decorations)
- Mac上使用brew update会卡住的问题 (solved some source downloading problem in China)