You Need a Better Terminal Setup

Photo by Fotis Fotopoulos on Unsplash

For many developers, the terminal is a second home. Whether it’s navigating through your file system, editing files, or executing git commands, it’s important to have your terminal optimized for productivity. Here’s my setup that helped me accomplish just that.

Here are some requirements to setup your mac terminal.

  • Homebrew — Homebrew is a package manager for macOS. You will use this to install the terminal packages. If you do not have Homebrew, you can find the install instructions here.
  • iTerm2 — iTerm2 is a macOS terminal that we will utilize to replace the vanilla terminal. More info on this coming up.
  • zsh — zsh, also known as the Z shell, is a Unix shell that is built on top of the macOS default shell: bash. This allows for some more customization that isn’t standard with the macOS bash shell.
  • Oh-My-Zsh — Oh-My-Zsh is a framework that helps manage your zsh configuration. It is open source and always evolving for the better.

The Tools

First, if you haven’t already, install Homebrew. Homebrew is a package manager that allows you to download packages from the internet via the terminal. The install instructions can be found here or you can copy and paste the following command into your terminal.

Next, install iTerm2. You can find the download and more information here. iTerm2 is an emulated macOS terminal that we will use to replace our current terminal. If you are comfortable using the bash shell and do not want to utilize zsh you can absolutely stop here! There are still plenty of benefits of utilizing iTerm2 over the vanilla macOS terminal.

zsh is another Unix shell, like bash, that you can utilize in your new terminal. Why should you use zsh over bash? Here are a few features that may make you want to make the switch.

  • No need for cd — You can automatically navigate to a directory by simply typing in the directory path.
  • Spelling auto-correction — Unlike bash, the Z shell has spelling corrections built in. This comes in handy if you are zooming in the terminal and mistype a command or folder.
  • Plugins — The amount of plugins is incredible. Customizing your terminal has never been easier.
  • Themes — There are a lot of different themes that are simply ascetically pleasing. You know the saying look good feel good? Well, we can apply that to the terminal easily with the Z shell.

Oh-My-Zsh is one of the most used frameworks for the Z shell. It comes with many plugins and themes that you can take advantage of to make your terminal look, feel, and operate extremely well. To install Oh-My-Zsh, run the following script in the terminal.

This should setup your terminal correctly, however, some have noticed it does not set the zsh shell as the default shell. If this is the case, simply run the following command to set it manually.

Let’s Configure our Terminal

Next, you will want to configure some items in your newly setup terminal. While the base setup is fine for many developers, we can leverage our new terminal’s customization features for an even better setup.

This site has a straight forward setup guide that we are going to pull from. First, we need to open the .zshrc file to view the configuration. I like to use vim, but this can be done however you’d like. Execute the command below.

This is your Z shell config file. This is where you can make customizations to your liking. When setting up a new Z shell, I like to update my plugins using the suggestions from this site. You can find a list of all of the plugins on the Oh-My-Zsh Wiki page. Plugins can be found in the plugin array in the .zshrc file. Below is what I typically use.

Lastly, you can update your theme as well. The default theme is the robbyrussel theme. But, a full list of themes can be found here. You can setup your theme in the .zshrc file.

Congrats! Your new terminal is now up and running, right? Unfortunately not yet. Once you are done editing your .zshrc file, execute the following command in the terminal.

This applies all of the changes you have made to your Z shell.

Conclusion

You have now setup your new terminal for better development. My biggest advice would be to customize this setup for you! If you mostly develop using python, find plugins for python. Dive deeper into the customizations you can create and comment your setup.

Sources

Jesus follower, Husband, tech enthusiast, GoldenDoodle Dad, coffee lover, software developer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store