DEV Community

Pradipta Sarma
Pradipta Sarma

Posted on • Edited on

Terminal Setup on macOS

Originally posted on my blog
This is what the default terminal looks like on a Mac:

Terminal on a Mac

And this sucks. It looks bad, it is hard to read, and differentiate. And there are no fancy colors.

To boost it up and level up the terminal game weโ€™re going to use use the following:

iTerm2
ZSH
Oh My ZSH
Enter fullscreen mode Exit fullscreen mode

Steps:

Install Homebrew. For that, run:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Enter fullscreen mode Exit fullscreen mode

You may need to install Command Line tool for X-Code before that.

xcode-select --install
Enter fullscreen mode Exit fullscreen mode

Download and install iTerm2 from here or run:

brew cask install iterm2
Enter fullscreen mode Exit fullscreen mode

Install ZSH and oh-my-zsh

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

To run zsh shell, run:

zsh
Enter fullscreen mode Exit fullscreen mode

Weโ€™re also going set up Auto Suggestions and Syntax Highlighting to make the experience friendlier and easier to use. To do that we need to edit the .zshrc file (located at ~/.zshrc). This is where most of our configuration is going to take place.

Install zsh-autosuggestions and zsh-syntax-highlighting:

brew install zsh-syntax-highlighting
brew install zsh-autosuggestions
Enter fullscreen mode Exit fullscreen mode

You can set your ZSH theme by putting in this line into your .zshrc file. Make sure you import the .zshrc after any change for it to reflect.

ZSH_THEME=robbyrussell
Enter fullscreen mode Exit fullscreen mode

At this point your terminal/iTerm2 should look something like:

iTerm2 with ZSH

And this is much better. Notice the short git commands that Iโ€™ve used? Well, those are configurable too. Follow this repository for the complete guide and .zshrc file with all the configurations, aliases and functions.

Thanks for reading.

Originally posted on https://pradipta.github.io/posts/zsh/

Find all my blogs at OmniaCode

Top comments (0)