DEV Community

Cover image for Terminal Setup - Make your Mac terminal awesome
Anthony Lagrede
Anthony Lagrede

Posted on

Terminal Setup - Make your Mac terminal awesome

I recently installed my new MacBook and set up my terminal. Here I'll show you how to do the same for your MacBook.

The final result

This is the end result based on the delicious powerlevel10k. Easy to configure and modify. Optimized to work as a developer.

You will notice the toolbar at the top (Cpu, Ram, Network) to always have an overview of the hardware consumption.

Mac terminal

Prerequisites

Install Homebrew

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

Install iTerm2 and git

brew install --cask iterm2
brew install git
Enter fullscreen mode Exit fullscreen mode

Install Oh My Zsh

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

Theme installation

I choosed powerlevel10k probably one of the best and most flexible theme you can choose.
You can easily change your terminal layout simply by rerun the installation command.

Start to install MesloLGS Fonts

MesloLGS NF Regular.ttf
MesloLGS NF Bold.ttf
MesloLGS NF Italic.ttf
MesloLGS NF Bold Italic.ttf
Enter fullscreen mode Exit fullscreen mode

Then install powerlevel10k itself

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

In ~/.zshrc set the ZSH theme to use:

ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.
Enter fullscreen mode Exit fullscreen mode

You will probably at least configure these two ZSH plugins:

zsh-syntax-highlighting - Fish shell like syntax highlighting for Zsh. This is what makes my aliases/commands green above. If it's green then it's installed!
zsh-autosuggestions - Fish-like autosuggestions for zsh. Will show a preview of the last matching command while typing. Press right to use

In ~/.zshrc set the ZSH plugins to use:

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

Restart your terminal with Zsh

Now you can run

p10k configure
Enter fullscreen mode Exit fullscreen mode

If you have issue with fonts, check MesloLGS font is selected.
Open iTerm2 → Preferences → Profiles → Text and set Font to MesloLGS NF.

Finally, if you want to include your existing bash aliases and functions:
In ~/.zshrc source your bash_profile just before the export ZSH

source ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

Add the Toolbar

Toolbar

Open your iterm2 > Profile > Session > Status bar enabled
iterm2 conf

Select your widgets
iterm2 status bar widgets

Finished!

I hope this small tutorial will help you to improve your setup. It is obviously not complete but easy enough to move on.

Discussion (12)

Collapse
zwacky profile image
Simon Wicki

First time I saw the toolbar feature in a CLI, sweet. Time to toy around with that one.

I can recommend these two tools to improve the Git experience on the CLI:

Collapse
thomasbredi profile image
Thomas Bredillet

For install this two plugins :

git clone github.com/zsh-users/zsh-autosugge... ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone github.com/zsh-users/zsh-syntax-hi... ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

Collapse
sansk profile image
Sangy K

Is there something like this for windows terminal/powershell?

Collapse
zeeshan profile image
Mohammed Zeeshan

ohmyposh. scott hanselman has some oretty good articles and videos on setting this up

Collapse
sansk profile image
Sangy K

Thanks. I will check it out

Collapse
alagrede profile image
Anthony Lagrede Author • Edited on

Hi Sangy,
Yes, there is also ohmyposh. Take a look here for Windows 😊:
dev.to/alagrede/terminal-setup-mak...

Collapse
sansk profile image
Sangy K

Thanks. I will check it out

Collapse
gnsp profile image
Ganesh Prasad

I have been using the same setup for last 5 years now. I use the font firacode though.

Collapse
chideraike profile image
Chidera

Thanks for this, I found it helpful

Collapse
devphu profile image
PhanPhú

it has work with mac chip m1?

Collapse
alagrede profile image
Anthony Lagrede Author

Hi @devphu, yes of course.

Collapse
rannn505 profile image
Ran Cohen

Check out my post for more awesome features 🦄