My Terminal Setup
Tags: bash, zsh, mac, terminal
Published: 2019-01-20 16:30:23

---
title: My Terminal Setup
published: true
description: My current terminal setup on macOS.
tags: bash, zsh, mac, terminal
cover_image: https://res.cloudinary.com/michaeldscherr/image/upload/v1548001641/Dev.to/Posts/My%20Terminal%20Setup/hero-img.jpg
---

I thought I'd share my current `terminal` setup. Over the years, I've been able to optimize my workflow. This allows me to:

- find information quicker
- reduce the time I spend searching for commands
- become more comfortable with `cli's` in general
- look like [a badass][borderlands-2-badass]

My evolution has been interesting over the years. In the beginning, I was that developer who used every plugin imaginable (for the `['terminal', 'IDE', 'etc']`). Then I watched [this video from MPJ][youtube-mpj-what-editor-do-you-use] about productivity in the workplace. I then started scaling back to where I am now.

## App

I use `macOS` 99% of the time, so my go to app is [iTerm2][iterm-2].

### Installation

You can download it from [iTerm2's website][iterm-2], or install through [Brew Cask][brew-cask]:

_pro tip: [Brew Cask][brew-cask] is amazing, it can install and manage all of your Mac applications through a simple `cli`._

```bash
brew cask install iterm2
```

## _Oh My_ ZSH

I've experimented with other `shell's` like [fish][github-fish-shell], but they were always too abstracted, or were too complicated.

### Installation

```bash
# if you don't have zsh installed
brew install zsh

# install oh my zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
```

### Theme

I use the [robbyrussel][zsh-robby-russell-theme] theme. It gives me `git` information, which is perfect.

It also trims the `directory path`, so you only see the `current directory`. This avoids obnoxiously long folder paths taking up valuable space.

```bash
# ~/.zshrc
ZSH_THEME="robbyrussell"
```

### Plugins

I only use a few plugins:

- [z][zsh-z] - _native plugin, don't need to install_
- [zsh completions][zsh-completions]
- [zsh autosuggestions][zsh-autosuggestions]

#### Installation

```bash
# zsh completions
git clone https://github.com/zsh-users/zsh-completions \
    ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-completions

# zsh autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions \
    ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
```

Then update your `~/.zshrc`:

```bash
# ~/.zshrc

plugins=(
  z
  zsh-completions
  zsh-autosuggestions
)

autoload -U compinit && compinit
```

Then `source` your configuration:

```bash
source ~/.zshrc
```

## Bonus: Keyboard Bindings

```bash
# ~/.zshrc

bindkey -e

# allows you to use the `option + [left, right]` key
# to skip words in a command you're writing.
bindkey '\e\e[C' forward-word
bindkey '\e\e[D' backward-word


# allows you to use the `[up, down]` key on a partial command
# to search your bash history for similar commands
bindkey '\e[A' history-search-backward
bindkey '\e[B' history-search-forward
```

## Conclusion

I do believe there is a happy medium between no tooling, and too much tooling. You can have enough to be dangerous, but not enough to overwhelm you.

For a more in depth overview of what I use on a daily basis, checkout my [Uses page on my website][michaeldscherr-uses].

[iterm-2]: https://www.iterm2.com/
[brew]: https://brew.sh/
[brew-cask]: http://caskroom.io/
[michaeldscherr-uses]: https://www.michaeldscherr.com/uses/
[borderlands-2-badass]: https://www.youtube.com/watch?v=_czwLSCEKEM
[youtube-mpj-what-editor-do-you-use]: https://youtu.be/dIjKJjzRX_E?t=498
[github-ohmyzsh]: https://github.com/robbyrussell/oh-my-zsh
[github-fish-shell]: https://github.com/fish-shell/fish-shell
[zsh-robby-russell-theme]: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#robbyrussell
[zsh-autosuggestions]: https://github.com/zsh-users/zsh-autosuggestions
[zsh-completions]: https://github.com/zsh-users/zsh-completions
[zsh-z]: https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins#z