最终效果图:

美化后的终端

需要安装的清单有:

安装过程

  1. 安装iTerm2,然后依次打开 Preferences-Appearance-General-Theme,选择Minimal。
  2. 下载安装Dracula主题
1
$ git clone https://github.com/dracula/iterm.git

​ 然后按照官网描述的步骤安装即可,完成后:

Dracula主题设置
  1. 设置背景图片,依次打开iTerm2-Preferences-Profiles-windows-Background Image,选择enable,然后选择自己喜欢的图片,我选择的是漫画《鬼刀》里的一张高清图片,设置图片的背景透明度可以拖动Blending旁边的滑动条实现。图片资源地址点击这里

    iTerm2背景图片
  1. 设置显示信息。依次打开iTerm2-Preferences–Session,勾选Status bar enable,Configure Status Bar,把上面的一些功能拖动到下面的框框里即可。我选择了当前文件夹,网速和搜索。打开Preferences-Window-Window custom title,填入想要的标题,我填的是iMac。

  2. 将默认shell设为zsh,

    1
    2
    3
    chsh -s /bin/zsh
    echo $SHELL
    # 输出 /bin/zsh

    然后安装oh my zsh,

    1
    sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  3. 安装Spaceship 主题,首先按照官网给的步骤下载:

    1
    2
    3
    git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"

    ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

    然后打开~/.zshrc,将ZSH_THEME修改为ZSH_THEME="spaceship"。最后source ~/.zshrc重新加载配置文件。

  4. 下载Powerline fonts:

    1
    2
    3
    4
    5
    6
    7
    8
    # clone
    git clone https://github.com/powerline/fonts.git --depth=1
    # install
    cd fonts
    ./install.sh
    # clean-up a bit
    cd ..
    rm -rf fonts

    设置字体,依次打开iTerm2-Preferences-Text-Font,我选择的是Fira Mono for Powerline字体。

  5. 安装插件zsh-syntax-highlightingzsh-autosuggestions

    1
    2
    3
    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

    然后在~/.zshrc中,添加插件:

    1
    2
    # Add wisely, as too many plugins slow down shell startup.
    plugins=(git z osx extract zsh-syntax-highlighting zsh-autosuggestions)

    其中,z,osx,extract是oh-my-zsh自带的插件,可以选择添加。添加完成后,再次执行source ~/.zshrc

​ 至此,美化过程结束。