DEV Community

Lana Kushnir
Lana Kushnir

Posted on • Updated on

Set up Terminal on Mac 2022

Setting up new Terminal on Mac

  • iTerm2
  • Homebrew
  • Git
  • Zsh (Z Shell) and ohmyzsh
  • ohmyzsh Themes
  • ohmyzsh Plugins
  • iTerms2 Color Schemes

1. iTerm2

Download at iterm2.com/downloads

Set out Status Bar Component Menu
iTerm2 > Preferences > Profiles > Session > Status bar enabled > Configure Status Bar

Check out other features at iterm2.com/features

2. Homebrew

Download at brew.sh
or run this in terminal

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Enter fullscreen mode Exit fullscreen mode

It will automatically install Developer tools if not available in your system.
When installation is done, run the two commands from the "==> Next steps:" section found in output of your terminal
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/lana/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

3. Git

Mac already comes with git installed
git --version
=> git version 2.30.1 (Apple Git-130)
Get the latest version of git by installing it with Homebrew

brew install git
Enter fullscreen mode Exit fullscreen mode

git --version
=> git version 2.36.1
Double-check your git global configurations
git config --global --list
If your user.email and user.name are not set, run the following to set your git global configurations
git config --global user.email "<youremail>"
git config --global user.name "<yourname>"
Reference: git-scm.com/download

4. zsh and ohmyzsh

zsh

Mac already comes with zsh installed and set as a default
Check what shell is set as a default
echo $SHELL
=> /bin/zsh
If the return is not the above, install zsh with Homebrew

brew install zsh
Enter fullscreen mode Exit fullscreen mode

zsh --version
=> zsh 5.8.1 (x86_64-apple-darwin21.0)
Then Change the default shell in Terminal on Mac or run the following
chsh -s $(which zsh)

ohmyzsh

Install ohmyzsh, the following will run the install script from Github ohmyzsh's install.sh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode

Reference: ohmyz.sh

5. ohmyzsh Themes

Pick a theme for your ohmyzsh look, and there are many available at Github: ohmyzsh Themes wiki page
What's the best theme for Oh My Zsh?
Reddit: What are some of the best Zsh themes

The most popular theme is PowerLevel10k

Install PowerLevel10K theme

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Enter fullscreen mode Exit fullscreen mode

open ~/.zshrc
find a line ZSH_THEME=" and update it
ZSH_THEME="powerlevel10k/powerlevel10k"

Change PowerLevel10k configurations
p10k configure
Change iTerm2 font (reddit reference)

  • Quit iTerm2 - iTerm2 > Quit iTerm2 or press ⌘ Q.
  • Start iTerm2.
  • Click iTerm2 > Preferences > Profiles > Text.
  • If you have multiple profiles, on the left, click the one you want to change.
  • Adjust Font on the right.

6. ohmyzsh Plugins

A list of all ohmyzsh plugins is available at Github ohmyzsh/plugins
or run ls ~/.oh-my-zsh/plugins
To see which plugins are enabled, run
echo $plugins

There are also lots of custom plugins built within zsh-users community. Install the following custom plugins:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Enter fullscreen mode Exit fullscreen mode
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Enter fullscreen mode Exit fullscreen mode
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
Enter fullscreen mode Exit fullscreen mode

open ~/.zshrc
find the line source "$ZSH/oh-my-zsh.sh"
add the following before that line

fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
Enter fullscreen mode Exit fullscreen mode
  • Activate custom plugins

open ~/.zshrc
find a line plugins=( and update it

plugins=(
git 
zsh-autosuggestions 
zsh-syntax-highlighting
zsh-completions 
)
Enter fullscreen mode Exit fullscreen mode

7. iTerm Color Schemes

Github mbadolato/iTerm2-Color-Schemes
Import color schemes into iTerms 2

cd Downloads
wget https://github.com/mbadolato/iTerm2-Color-Schemes/archive/refs/heads/master.zip
unzip master.zip
Enter fullscreen mode Exit fullscreen mode

You may need to install wget and unzip Homebrew formulae
brew install wget
brew install unzip
Import .itemcolors items found at ~/Downloads/iTerm2-Color-Schemes-master/schemes
iTerm2 > Preferences > Profile > Colors > Color Presets > Import

To delete them later, follow this Bulk remove iTerm2 color schemes guide.

Update:
How to go one word backwards and forwards using Option key + Left key and Option key + Right key
https://apple.stackexchange.com/a/293988


References:

Top comments (0)