How I customize my Mac terminal with open source tools (2023)

The command line is an important part of every developer's workflow. This makes it important that you set up your terminal in ways that improve your productivity and decrease your frustration.

In this article, I'll explain how I customize my macOS Z shell (zsh) terminal with iTerm2, Oh My Zsh, and Powerline10k. If you're a Mac user and would like to try it, follow along with this how-to. If you're a Linux user, you can read this article about themes and plugins for Zsh.

Install Homebrew

Homebrew is the easiest way to install and manage utilities on a Mac. Before you can install Homebrew, you must install the Xcode tools (or the complete version of Xcode, if you prefer). Install Xcode tools with:

xcode-select — install

Then install Homebrew by entering this command in a macOS terminal or Linux shell prompt:

$ curl -fsSL --output homebrew_installer.sh \https://raw.githubusercontent.com/Homebrew/install/master/install.sh 

Before executing an install script on your system, review it to ensure it's not malicious:

$ more homebrew_installer.sh 

Once you're comfortable with what the script is going to do, you can safely execute it:

$ bash homebrew_installer.sh

If you get an error on MacOS, run xcode-select -r to reset xcode-select.

For more information about Homebrew, read Matthew Broberg's articleIntroduction to Homebrew: the painless way to install anything on a Mac.

Install iTerm 2

I use iTerm2 as my terminal emulator. I really enjoy it because of its many great features, including search, autocomplete, paste history, and thousands of helpful functions, helpers, plugins, themes, and a few things that may make you shout with joy.

Install iTerm 2 with Homebrew using:

brew cask install iterm2

Or, you can download and install iTerm2 from its website and drag and drop the file into your Application folder.

If you're on Linux, the default terminals (such as GNOME terminal, Konsole, XFCE terminal, or similar) match or exceed the features of iTerm2, so you can use whatever you already have installed.

Install and set up Zsh as default

Test whether you already have Z shell installed:

(Video) How To Make Your Boring Mac Terminal So Much Better

$ zsh --version

If you don't have Z shell installed, you can install it with Homebrew on MacOS or Linux:

$ brew install zsh

Or your default package manager on Linux:

$ sudo dnf install zsh

Set zsh as your default shell by running the following command in iTerm2, and then relaunch the terminal:

$ chsh -s /bin/zsh

You can verify the shell you're running with the echo command. By echoing the zeroth argument of your command, designated by the variable $0, you can learn what shell you're interfacing with.

$ echo $0/bin/zsh

Install Oh My Zsh

More Great Content

Oh My Zsh is a delightful open source framework for Z shell that can be used on GNU Linux and macOS computers. It modernizes the terminal with simple solutions for managing your zsh configuration. Instead of a .bash_profile, zsh uses a .zshrc file to save your customizations.

Its features include:

  • Instead of thecd (change directory) command, navigate directories with just: .. (parent dir), ... (parent from parent dir), / (root), or ~ (home).
  • Instead of the mkdir and cd commands, use the take command to create a directory and change the path to it.
  • Switch between the last and current path with a hyphen -.
  • List all alias commands with alias or filter them with grep; for example, alias | grep git.
  • With the Z plugin, quickly change to another path by naming the folder rather than the complete path.
  • Recursive path expansion(for example,/u/lo/b expands to /user/local/bin after pressing the Tab key)
  • Spelling corrections, approximate completion, and automatic correction when you make a minor mistake typing a directory name
  • Pluginand theme exports
  • Syntax highlighting
  • History substring search and accessing specific lines by running the history command with ! followed by its line number;e.g., !137
  • Autocomplete, jump between options with Tab, and press Return to make a selection; works with directories, files, and commands
  • Git integration
  • Much more

Install Oh My Zsh with:

$ curl -fsSL --output omz_installer.shhttps://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh

Read the script over to ensure it's safe, and then execute it:

$ zsh omz_installer.sh

Then restart iTerm2 to experience the new world of Oh My Zsh.

(Video) This is how to make your terminal look like a pro #technology #programming #software #opensource

$ sh ./omz_installer.sh Cloning Oh My Zsh...Cloning into '/home/sek/.oh-my-zsh'...remote: Enumerating objects: 1155, done.[...]Using the Oh My Zsh template file and adding it to ~/.zshrc.Time to change your default shell to zsh:Do you want to change your default shell to zsh? [Y/n] nShell change skipped. __ __ ____ / /_ ____ ___ __ __ ____ _____/ /_ / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ /____/ ....is now installed!Before you scream Oh My Zsh! please look over the ~/.zshrc file to select plugins, themes, and options.• Follow us on Twitter: https://twitter.com/ohmyzsh• Join our Discord server: https://discord.gg/ohmyzsh• Get stickers, shirts, coffee mugs and other swag: https://shop.planetargon.com/collections/oh-my-zsh➜ ~ 

Check the installed version with:

zsh --version

Upgrade it with:

upgrade_oh_my_zsh

Customize your terminal's theme, fonts, colors, and more

To get the best out of zsh, you'll want to install some dependencies.

Use a custom theme

Powerlevel10k is a popular theme for zsh. It emphasizes speed, flexibility, and out-of-the-box experience.

Install Powerlevel10k for Oh My Zsh with:

git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

Then enable it in ~/.zshrc. Open the config file (.zshrc) by running:

Nano ~/.zshrc

Change the value of ZSH_THEME to:

ZSH_THEME="powerlevel10k/powerlevel10k"

Save and update the changes by running the command source ~/.zshrc. Powerlevel10k's configuration wizard should start automatically; enter p10k configure if it doesn't. Now you can start choosing your user interface options.

Change your color scheme

You can change the terminal's color scheme to match your preferences. In this tutorial, I am using Dracula dark theme for iTerm2.

(Video) Make your terminal window pretty on Linux/MacOS with open source based theme tools

If you are a Git user, you can install the Dracula theme and keep it up to date by cloning the repo:

$ git clone https://github.com/dracula/iterm.git

Or you can install it manually by downloading the .zip file and unzipping it. Then:

  1. Navigate to iTerm2 > Preferences > Profiles > Colors.
  2. Open the Color Presets drop-down in the bottom-right corner.
  3. Select Import from the list.
  4. Select the Dracula.itermcolors file.
  5. Select Dracula from Color Presets.

Install fonts

Powerline10k has a wide variety of fonts you can use. If you want to unlock all of Powerlevel10k's prompt styles, download and install Meslo Nerd Font before running p10k configure. To install it, navigate to iTerm2 > Preferences > Profiles > Text and set Font to MesloLGS NF.

You can find more information about installing fonts in the Powerline10k GitHub repository.

(Video) Customize your terminal on MacOS like a pro 🔥 | oh-my-zsh | powerlevel10k | iTerm2

Recommended plugins

Oh My Zsh has a lot of plugins that add features. Two I recommend highly are:

  1. zsh-autosuggestions: Autocompletes suggestions based on your history. It's really useful for commonly used commands like docker run, php artisan, and magerun. Install it with:

    $ git clone https://github.com/zsh-users/zsh-autosuggestions \${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  2. zsh-syntax-highlighting: This feature highlights correctly typed commands green, incorrect commands red, and underlines folders and files.

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

To activate the plugins, in ~/.zshrc, change the line that starts with plugins= to:

plugins=( git zsh-syntax-highlighting zsh-autosuggestions)

Restart the terminal and enjoy!

What's next?

This is only the beginning of how you can customize zsh to suit your workflow. Please share your favorite zsh productivity tips in the comments.

How I customize my Mac terminal with open source tools (5)This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.

FAQs

How do I customize my Terminal on Mac? ›

In the Terminal app on your Mac, choose Terminal > Settings, then click Profiles. Do one of the following: Create a new profile: Click the Add button under the profiles list, then enter a name for the new profile. Modify an existing profile: Select the profile you want to modify.

How do I customize my Terminal? ›

Open the Terminal app, then open up the Preferences menu (under Terminal in the menu bar, or with the Command + , keys on macOS). Then, select the Profiles tab. On the left, you'll see an assortment of built-in themes you can choose. They include a mix of colors and typography.

How do I make Terminal read easier? ›

For readability, try changing colors, font size and contrast in the Terminal Preferences.

Can you change the Terminal theme on Mac? ›

Step 1: Setting A Theme

terminal file into your Terminal Profiles list. You should see it pop up here: Select the One Dark profile and press the Default button at the bottom of the list to set it as your default. To apply some of the changes in this guide, you'll need to open a new Terminal window.

Should I use bash or zsh on Mac? ›

The Z shell (also known as zsh ) is a Unix shell that is built on top of bash (the default shell for macOS) with additional features. It's recommended to use zsh over bash . It's also highly recommended to install a framework with zsh as it makes dealing with configuration, plugins and themes a lot nicer.

Is Bash better than zsh? ›

Zsh is more interactive and customizable than Bash. Zsh has floating-point support that Bash does not possess. Hash data structures are supported in Zsh that are not present in Bash. The invocation features in Bash is better when comparing with Zsh.

How do I change the default open in Terminal? ›

Specify the default profile
  1. In the Terminal app on your Mac, choose Terminal > Settings, then click Profiles.
  2. Select the profile that you want to use as the default profile.
  3. Click Default at the bottom of the profiles list.

How do I make terminal awesome? ›

zsh-autosuggestions
  1. Add zsh-autocomplete to the list of plugins inside ~/. zshrc plugins=( [plugins…])
  2. Commit the changes by running source ~/.zshrc.
Jun 27, 2022

How do I make my terminal look good? ›

Click the option on the top right or left, depending on your system, and go to Preferences. There, you can change the theme, and make it dark to look cooler. There is also a setting for transparency where you can make the terminal transparent.

How do I make my Mac terminal more colorful? ›

Use Text settings in Terminal to change the font, text, color, and cursor options for a Terminal window profile. To change these settings in the Terminal app on your Mac, choose Terminal > Settings, click Profiles, select a profile, then click Text.

How do I change the color of my Terminal? ›

To change the color of terminal output in Gnome-Terminal, open the terminal and go to “Edit -> Profile Preferences”. In the "Colors" tab you can change the background and text color of the terminal.

Videos

1. How to setup your Mac Terminal to be beautiful
(typecraft)
2. ULTIMATE macOS Terminal (zsh) in 10 Minutes! - 2020 EDITION
(Baober)
3. Make Your Mac Terminal Beautiful in Under 10 Minutes! [Oh My Zsh & Powerlevel10k]
(Jake Fishman)
4. 6 AWESOME Command Line Tools For MAC And LINUX
(Tech Craft)
5. macbook dev setup // customize terminal, coding tools, 2021 m1 MacBook Pro
(marsela)
6. How I setup the Terminal on my M1 Max MacBook Pro
(Engineering with Utsav)
Top Articles
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated: 19/10/2023

Views: 6278

Rating: 4.8 / 5 (68 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.