If you’re setting up your MacBook for development, having a well-configured terminal is essential. This guide will walk you through installing and configuring a powerful terminal setup using Homebrew, iTerm2, and Oh My Zsh, along with useful plugins.
1. Install Homebrew
Homebrew is a package manager that simplifies installing software on macOS.
Open the Terminal and run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After installation, add Homebrew to your PATH by running the following commands:
echo >> ~/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Verify installation:
brew --version
Check here.
2. Install iTerm2
The default macOS Terminal is functional but lacks advanced features. iTerm2 is a powerful alternative.
Install it using Homebrew:
brew install --cask iterm2
Open iTerm2 from your Applications folder after installation.
Check and Install Git
Ensure Git is installed:
git --version
If not installed, install it using Homebrew:
brew install git
3. Install Oh My Zsh
Oh My Zsh enhances the Zsh shell with themes and plugins. Install it with:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Check here.
Configure .zshrc
Edit your .zshrc file:
vim ~/.zshrc
Add useful plugins:
plugins=(git rails ruby)
The default theme is robbyrussell. You can explore other themes here.
Customize iTerm2 Color Scheme
Find and import themes from iTerm2 Color Schemes.
4. Add Zsh Plugins
Enhance your terminal experience with useful plugins.
a. Install zsh-autosuggestions
This plugin provides command suggestions as you type.
Install via Oh My Zsh:
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Or install via Homebrew:
brew install zsh-autosuggestions
Add to ~/.zshrc:
plugins=(git rails ruby zsh-autosuggestions)
If installed via Homebrew, add:
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
to the bottom of ~/.zshrc.
Restart iTerm2:
exec zsh
b. Install zsh-syntax-highlighting
This plugin highlights commands to distinguish valid syntax from errors.
Install via Oh My Zsh:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Add to .zshrc:
plugins=(git rails ruby zsh-autosuggestions zsh-syntax-highlighting)
Restart iTerm2:
exec zsh
Wrapping Up
Your terminal is now set up for an optimized development experience! With Homebrew, iTerm2, Oh My Zsh, and useful plugins, your workflow will be faster and more efficient.
to be continued …