iTerm2 + zsh + oh-my-zsh The Most Power Full Terminal on macOS

iTerm2 + zsh + oh-my-zsh The Most Power Full Terminal on macOS

Image for posthttps://github.com/MartinSeeler/iterm2-material-design/blob/master/img/screen-mock-2.jpg?raw=true

Are you struggling in the default terminal?

Do you want your terminal to look like an image above?

If you want your terminal to look like in the picture above. Come on, you?re the person who must worth reading this blog.

Install Homebrew

Image for posthttps://www.iterm2.com/img/logo2x.jpg

  1. Open terminal and paste.

/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

Download iTerm2

Why we must replace default macOS Terminal to iTerm2 ?

  1. Go to download page https://www.iterm2.com/downloads.html
  2. After downloaded, drag and drop file into our Application folder.

Or if you just type (require homebrew installed)

brew cask install iterm2

Install zsh

  1. Open terminal and paste.

brew install zsh

We need you ?oh-my-zsh?

Image for post

Oh-My-Zsh is an open source, community-driven framework for managing your ZSH configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes and a few things that make you shout?

?Oh My ZSH!?

Install oh-my-zsh

The oh-my-zsh will be replace default terminal with zsh automatically when you installed.

  1. Open terminal and paste.

sh -c “$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)”

Decorate Our iTerm2 With Material Design Colours

Image for posthttps://github.com/MartinSeeler/iterm2-material-design/blob/master/img/screen-mock-1.jpg

1. Open terminal and paste.

$ cd Downloads$ curl -O https://raw.githubusercontent.com/MartinSeeler/iterm2-material-design/master/material-design-colors.itermcolors

2. Open iTerm2 that we already downloaded at the first section

3. Go to iTerm2 > Preferences > Profiles > Colors Tab

4. Click Color Presets? at the bottom right

5. Click Import?

6. Select the material-design-colors.itermcolors file

7. Select the material-design-colors from Load Presets?

Image for postiTerm2 with Dracular theme ref: https://draculatheme.com/assets/img/screenshots/iterm.png

Dracula theme is also good click see more.

Manage Plugins

Plugin wiki page: https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins

In this case I want to enable plugin ?docker? on my zsh, so I?ll run this command

vi ~/.zshrc

and type ?/plugin? (without quotes) press enter, type ?i? character and insert the plugin that you want to add.

…# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/# Example format: plugins=(rails git textmate ruby lighthouse)# Add wisely, as too many plugins slow down shell startup.plugins=( git)

In this case, I?ll add docker plugin, just add ?docker? to our parentheses.

…# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/# Example format: plugins=(rails git textmate ruby lighthouse)# Add wisely, as too many plugins slow down shell startup.plugins=( git docker)

After you satisfied, press ?Esc? and type ?:wq? which means you save a file and exit immediately. And restart iTerm2.

Add An Alias (Permanent Alias)

vi ~/.zshrc…# Example aliases# alias zshconfig=”mate ~/.zshrc”# alias ohmyzsh=”mate ~/.oh-my-zsh”alias dkps=”docker ps”alias dkst=”docker stats”alias dkpsa=”docker ps -a”alias dkimgs=”docker images”alias dkcpup=”docker-compose up -d”alias dkcpdown=”docker-compose down”alias dkcpstart=”docker-compose start”alias dkcpstop=”docker-compose stop”

If I go type ?dkps? it will be execute ?docker ps?

27