Level up your Terminal with iTerm2 and Oh My Zsh
Having a terminal with the right tools can increase productivity exponentially which is what we are all about!
1. iTerms2
Coming from a simple Mac terminal, iTerms2 offers a lot more customizations and tools which makes it easier and quicker to use.
Instructions to install: https://www.iterm2.com/
If you have homebrew installed, you can run the below instead:
brew install --cask iterm2
2. ZSH
The Z shell (Zsh) is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting.
To install Zsh, make sure you have Homebrew installed, then run the below in your terminal
brew install zsh
To check if Homebrew is installed, run
brew help
If it errors, follow these instructions to install it: https://brew.sh/
3. Oh My Zsh
Oh My Zsh is a Zsh framework that has many great plugins. It also contains a lot of themes for your terminal. It will be useful to install the next tools.
Instructions to install oh-my-zsh: https://github.com/ohmyzsh/ohmyzsh#basic-installation
Oh My Zsh also comes with a config for git aliases, so you can write your git commands much quicker:
- gp instead of git push
- gl instead of git pull
- gcmsg instead of git commit -m
Run alias to view all the git command shortcuts.
4. Spaceship-prompt
Now comes the fun bit where you can add a nice theme and cool visuals on your repository. Here is the list of some of the many things it includes:
- Clever hostname and username displaying.
- Prompt character turns red if the last command exits with non-zero code.
- Current Git branch and rich repo status
- Package version, if there’s is a package in the current directory
- etc…
Instructions to install: https://github.com/spaceship-prompt/spaceship-prompt#installing
The CLI should now look something like this:
5. Autosuggestion
This is by far my favorite ZSH plugin. It shows in light grey an autocompletion suggestion as you type a command.
Instructions to install: https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md#oh-my-zsh
6. The fuck
I didn’t mean to be rude, The fuck is actually the name of an add-on for your terminal which suggests corrections of the previous command you entered. Below I mistyped git status
so instead of retyping it, I can type fuck
and it will suggest the command it thinks I wanted to type, git status
.
Instructions to install: https://github.com/nvbn/thefuck#installation
7. Startup directory
If like me you save all your repositories inside a folder, you can set ITerm to open from this directory on startup under Preferences > Profiles > Working Directory. A small change that will save so many repetitive keystrokes.
Wrapping up
I hope you found this article useful, please share your terminal tips in the comments! :)