去年感興趣,在網上搜了搜 iTerm2的安裝與配置方法,按照大神的步驟確實達到了Demo上的樣子,但是我Mac自帶的終端就有些丑了。
為了改善這一點,今天我又重新設置了一下,如果有需要,可參考一下。
參考文章來自:http://www.siguoya.name/pc/home/article/256
1. 安裝iTerm2:官方下載地址 http://www.iterm2.com/downloads.html
2. 安裝Oh My Bash
2.1通過cat /etc/shells
命令可以查看當前系統可以使用哪些shell;
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
2.2通過echo $SHELL
命令可以查看我們當前正在使用的shell;
# Mac系統中默認的shell為bash shell
/bin/bash
2.3如果當前的shell不是zsh,我們可以通過chsh -s /bin/zsh
命令可以將shell切換為shell之zsh,終端重啟之后即可生效。
3.安裝Oh My ZSH
官方推薦安裝方法:
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
* FQ的童鞋,需要先關閉代理(不然沒法下載成功)
安裝成功:
4.設置Oh My Zsh主題
Oh My Zsh提供的所有主題在線預覽:https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
對主題進行修改。
vi ~/.zshrc
使用,設置ZSH_THEME=""
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/joanna/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="gianu"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
我是設置為:ZSH_THEME="gianu",也可以設置為ZSH_THEME="agnoster"。
設置為ZSH_THEME="agnoster",可實現下圖這樣➡️形狀路徑,就不用反復通過pwd查看了。
我設置的ZSH_THEME="gianu",是下面的這個樣子滴:
我設置為"agnoster"后終端主題會比較難看,所以按照上面介紹的Oh My Zsh主題在線預覽鏈接,挑選了自己喜歡的主題"gianu"。
大家可根據自己的偏好,設置哦。