/ iterm2

ZSH ! Oh-my-zsh (Tools that makes you more productive)

I personally love this combination of iTerm2 + ZSH + Oh-my-zsh.

iTerm2 is an amazing terminal, I always prefer it over macOS default terminal. If you want to install it then just go to iTerm2 site , download it and install.

It has many advantages over macOS default terminal. Some of those are, easy finder you can easily search for the text in terminal, nice autocomplete feature, split panes, paste history and many more. I would highly recommend it and you can explore all of its highlighting feature

Oh-my-zsh (OMZ) really makes terminal (iterm2) more interesting and useful. You do not need to punch in same long command again and again. Rather you get the easy completion or shortcut commands by using various plugins of Oh-my-zsh (OMZ).

How to use iTerm2 + ZSH + Oh-my-zsh on you Mac


First of all install homebrew on your Mac to do that just paste this command on your terminal. Once brew is installed after that installing other packages is very easy.

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

Now we can install ZSH shell but before installing just check if it exists and what is the version you have

zsh --version
brew install zsh zsh-completions

Once ZSH is installed, you can install oh-my-zsh (OMZ) using curl or wget command

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

Or

sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

Post installation, you can customise ~/.zshrc file. This is the default file which gets generated. OMZ sets some basic configurations like theme, plugins etc.

This is the sample of ~/.zshrc file, just for reference.

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/.oh-my-zsh

# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="random"

# Set list of themes to load
# Setting this variable when ZSH_THEME=random
# cause zsh load theme from this variable instead of
# looking in ~/.oh-my-zsh/themes/
# An empty array have no effect
ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# 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=(jira git git-extras git-flow colored-man colorize github bundler pip python brew osx rails rvm redis-cli zsh-syntax-highlighting npm docker bower node sublime sudo supervisor web-search sublime yarn)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

.Zshrc Useful Configurations


Themes

In ~/.zshrc we can configure ZSH_THEME by three different ways.

Choose any of the theme of interest and then just assign it to ZSH_THEME

# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="mortalscumbag"

Set ZSH_THEME as random. In that case computer will choose random theme and it will change theme every time we load terminal. It will pick the theme from the default OMZ theme list

ZSH_THEME="random"

Another option to have random themes of your choice from a limited set. For that you can set ZSH_THEME and ZSH_THEME_RANDOM_CANDIDATES values and now terminal will pick the theme randomly from defined list.


ZSH_THEME="random" 
ZSH_THEME_RANDOM_CANDIDATES=(
"gallois"
"kolo"
"mortalscumbag"
)

Other than these default themes there are also many external custom themes too. You can also use those as per your interest.

Plugins

OMZ plugins are help for auto completion of the commands and aliases. These plugins really helps improving productivity.
To add the plugins of your choice, you have to update .zshrc -> plugins value as shown below.

# 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=(jira git git-extras git-flow colored-man colorize github bundler pip python brew osx rails rvm redis-cli zsh-syntax-highlighting npm docker bower node sublime sudo supervisor web-search sublime yarn)

As we use Jira storyboard, Ruby on Rails, JS frameworks (ember.js, react.js etc) for development, Redis etc. So these are some of the plugins which I really find useful.

GIT, as git commit, git checkout etc commands are used so frequently while you are doing development. By using GIT plugin you need not to type more character. Instead we just need to use shorthand, which saves a lot of time. All these git command shortcuts are well listed here

e.g.
**gc** for `git commit`
**g** for `git` 
**ga** for `git add` etc. 

Jira - if you use Jira and want to create JIRA issue from command line then you can use this plugin and before using this you have to set your jira_url so that it points to your jira url. There is one more modified JIRA plugin you can refer that here

For JavaScript packages you can use node, npm , bower, yarn etc plugins. These plugins provides some aliases and completions

e.g
Bower install   ---> . bi
Bower list        ---> . bl

In case of npm, node, yarn etc. it gives you option of auto completion. e.g. You just type npm i and tab it will show you possible commands starting with i which makes life easier.

There are many useful plugins which you can use as per your need.

Shivani Thakur

Shivani Thakur

I am life time learner, passionate about technology, fullstack programmer and prefer clean deliveries. I am fearless, honest and vocal about my thoughts.

Read More