欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!
因排版和原文中的一些bug,参照搜索引擎和原文有了本篇文章。
 
因为powerline以及homebrew均需要安装command line tool,网络条件优越的同学在执行本文下面内容之前,可以先安装XCode并打开运行一次(会初始化安装components),省去以后在iterm2中的等待时间。
 
另外,git也是必要的,各位可以自行下载安装,除了网络没有任何坑:
 
https://git-scm.com
 
介于此,本文默认各位同学已经安装了git环境和xcode(command line tools),遇到提示找不到git命令或需要安装command line tool的地方,文中不再赘述了。
 
下载iTerm2
 
可以直接去官网下载:https://www.iterm2.com/
 
安装完成后,在/bin目录下会多出一个zsh的文件。
 
Mac系统默认使用dash作为终端,可以使用命令修改默认使用zsh:
 
chsh -s /bin/zsh
 
如果想修改回默认dash,同样使用chsh命令即可:
 
chsh -s /bin/bash
 
OK,这就是iTerm2初始的样子,下面我们来美化它,让它变得更好用!
 
安装Oh my zsh
 
安装方法有两种,可以使用curl或wget,看自己环境或喜好:
 
# curl 安装方式
 
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
 
或者
 
# wget 安装方式
 
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
 
安装命令和安装完成后的截图:
 
oh-my-zsh开源地址:https://github.com/robbyrussell/oh-my-zsh
 
安装PowerLine
 
powerline官网:http://powerline.readthedocs.io/en/latest/installation.html
 
安装powerline的方式依然简单,也只需要一条命令:
 
pip install powerline-status --user
 
没有安装pip的同学可能会碰到zsh: command not found: pip。
 
使用命令安装pip即可:
 
sudo easy_install pip
 
安装后再次执行安装powerline的命令即可。
 
安装PowerFonts
 
安装字体库需要首先将项目git clone至本地,然后执行源码中的install.sh。
 
在你习惯的位置新建一个文件夹,如:——/Desktop/OpenSource/
 
在此文件夹下执行git clone命令:
 
# git clone
 
git clone https://github.com/powerline/fonts.git --depth=1
 
# cd to folder
 
cd fonts
 
# run install shell
 
./install.sh
 
执行结果如下:
 
安装好字体库之后,我们来设置iTerm2的字体,具体的操作是iTerm2 -> Preferences -> Profiles -> Text,在Font区域选中Change Font,然后找到Meslo LG字体。有L、M、S可选,看个人喜好:
 
安装配色方案
 
配色方案在使用VIM或Colorful Log时会变得非常有用,同时界面也不会一片黑绿一样死板。

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html/h63611.shtml