Level up your macOS terminal - Part One
Tags: productivity
Published: 2020-09-08 16:49:00

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](https://brew.sh)

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 :

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

# Terminal Setup

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

## [Option 1 : Kitty](https://sw.kovidgoyal.net/kitty/)

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

To install simply follow the [Quick start guide](https://sw.kovidgoyal.net/kitty/binary/)

## [Option 2 : Iterm 2](https://www.iterm2.com/) 

Firstly we'll replace the default Terminal by Iterm2, it has many great [features](https://iterm2.com/features.html), can display icons and has better support of Unicode.

### Installation
```bash
 brew install --cask iterm2
```

### 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/](https://iterm2colorschemes.com/).

You can also browse and create your own on [http://terminal.sexy/](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](https://ohmyz.sh/)

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

```bash
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
```

#### 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)
```

##### Plugins

A collection of my favourites plugins for zsh :

[Syntax Highlighting](https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md#oh-my-zsh): Add some syntax highlighting when you type in your terminal.

![an example of syntax highlight](https://dev-to-uploads.s3.amazonaws.com/i/se1bjabrg2jzgssqusnk.png)

[Auto Suggestion](https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md#oh-my-zsh): Provide suggestions based on either tab completion or your history.

![an exemple of auto suggestion](https://dev-to-uploads.s3.amazonaws.com/i/hi6nz3gwvopu9gd4xiep.png)

[FZF - Fuzzy finder](https://github.com/junegunn/fzf): 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](https://dev-to-uploads.s3.amazonaws.com/i/ouumgqy51t4x3n5aq7d4.png)

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](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/z): Provide you access to Z which tracks your most visited directories and allows you to access them very quickly.

![z example](https://dev-to-uploads.s3.amazonaws.com/i/fkqy8dp7cxc5rvodfboj.png)
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](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes).

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](https://github.com/romkatv/powerlevel10k#oh-my-zsh) 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!