DEV Community

Cover image for Level up your macOS terminal - Part One
William Leemans for JetDev

Posted on • Updated on

Level up your macOS terminal - Part One

About a year ago I changed my development computer from Windows to macOS. I always loved to customize, optimize and find the best tooling available to help me develop.

In Part One of this guide, we'll go through all the setup related to the terminal itself.

Part Two is a collection of the complementary tools I like.

Homebrew

In this guide, I'll use Homebrew to easily install everything on my computer.

It's a well-known packet manager for macOS, even though it's not always the best way to install everything, it's many times the easiest way.

Installation

simply paste the following in your terminal :

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

Terminal Setup

I would recommend you to choose between these two terminal emulator :

Option 1 : Kitty

With the offloading of the rendering to the GPU Kitty offers greater performances.

To install simply follow the Quick start guide

Option 2 : Iterm 2

Firstly we'll replace the default Terminal by Iterm2, it has many great features, can display icons and has better support of Unicode.

Installation

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

Customization

One of the most important customization steps is to choose a colour scheme that suits you.

You can find a list of the official iTerm2 themes here : https://iterm2colorschemes.com/.

You can also browse and create your own on http://terminal.sexy/

ZSH

Since macOS 10.15 Catalina, zsh is the default shell it is a highly customizable shell, designed to be interactive.

It has amazing completion capabilities, a smarter shared history and anything you know in bash still works!

Oh My Zsh

Zsh comes with a huge list of plugins, to help with managing them we'll use the best ZSH configuration manager: Oh My Zsh.

Installation

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

usage

To enable a plugin you just have to edit plugin list in the .zshrc located in your $HOME directory vi ~/.zshrc

For example, here is mine :

plugins=(git
         z                                                                         
         zsh-interactive-cd
         git-auto-fetch
         kubectl
         zsh-autosuggestions
         zsh-syntax-highlighting)
Enter fullscreen mode Exit fullscreen mode
Plugins

A collection of my favourites plugins for zsh :

Syntax Highlighting: Add some syntax highlighting when you type in your terminal.

an example of syntax highlight

Auto Suggestion: Provide suggestions based on either tab completion or your history.

an exemple of auto suggestion

FZF - Fuzzy finder: Provide a fuzzy finder for looking through anything, I use it mostly to search files or commands in my history. It is required by zsh-interactive-cd

Fzf with preview

See Part Two of this guide to know how you can plug it to bat and ripgrep to enable syntax colouring in preview and lightning-fast performances!

Z: Provide you access to Z which tracks your most visited directories and allows you to access them very quickly.

z example
Here I just typed 'z mac' and got moved to my macOS-setup repository.

Theming

There are a lot of available themes listed on the official page.

They can be enabled by setting the ZSH_THEME value to the name of the theme in your ~/.zshrc.

More themes can be found on the internet, I use the PowerLevel 10K Theme which I love for its look and the ease of customization through an interactive prompt.

Stay tuned for part 2 where we'll go into more tools to improve your daily terminal usage!

Top comments (0)