DEV Community

Cover image for Enhance Your macOS Terminal with Oh My Zsh, Autosuggestions, and Powerlevel10k
Arnav Sharma
Arnav Sharma

Posted on

Enhance Your macOS Terminal with Oh My Zsh, Autosuggestions, and Powerlevel10k

Introduction

As someone who spends a lot of time in the terminal, I know how powerful it can be for developers, system administrators, and tech enthusiasts like myself. The terminal provides a direct interface to the operating system, but the default experience can often feel plain and lacking in features that boost productivity and ease of use. Thankfully, I discovered tools and customizations that transformed my terminal into a visually appealing and highly functional workspace.

One of the first tools I came across was Oh My Zsh, an open-source framework that makes managing Zsh configurations incredibly easy. Zsh, or Z shell, is a powerful alternative to the default Bash shell on macOS, offering enhanced features like better tab completion, command history, and scripting capabilities. Oh My Zsh takes it a step further with a vast array of plugins and themes that have made my terminal sessions more efficient and enjoyable.

To further enhance my workflow, I added Zsh Autosuggestions. This handy tool provides intuitive command suggestions, allowing me to quickly recall and reuse commands without typing them out completely. It's been a game-changer, saving me time and reducing the repetitive strain of retyping frequent commands.

Finally, I discovered Powerlevel10k, a theme that not only makes my terminal look great but also provides a wealth of information at a glance. From showing the current git branch to displaying system load, Powerlevel10k has become an essential part of my terminal setup.

In this article, I'll walk you through how I set up Oh My Zsh on macOS, integrated Zsh Autosuggestions to improve my command-line experience, and installed Powerlevel10k to give my terminal a sleek, functional appearance. Whether you're a terminal pro or just starting out, these tools can revolutionize your command-line experience, making it more efficient, visually appealing, and tailored to your needs.


Setting Up Oh My Zsh on macOS

Step 1: Install Zsh

To get started, I first needed to ensure I had the latest version of Zsh installed. While Zsh comes pre-installed on macOS, I used Homebrew to update it to the latest version. Here's how I did it:

brew install zsh
Enter fullscreen mode Exit fullscreen mode

Step 2: Install Oh My Zsh

Next, I installed Oh My Zsh using a simple installation script. I chose to use curl, but wget works just as well:

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

Step 3: Set Zsh as the Default Shell

After installing Oh My Zsh, I set Zsh as my default shell:

chsh -s $(which zsh)
Enter fullscreen mode Exit fullscreen mode

I then restarted my terminal for the changes to take effect.

Step 4: Customize Oh My Zsh

I opened my .zshrc file to customize my Zsh setup, including themes and plugins:

nano ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

I set the theme to something I liked and added a few plugins to enhance my terminal's functionality. Once done, I reloaded my configuration with:

source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Enhancing Zsh with Autosuggestions

Step 1: Install zsh-autosuggestions Plugin

To add autosuggestions, I cloned the zsh-autosuggestions repository into the Oh My Zsh custom plugins directory:

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Enter fullscreen mode Exit fullscreen mode

Step 2: Enable the Plugin

I then enabled the plugin by editing my .zshrc file:

nano ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

I added zsh-autosuggestions to the list of plugins:

plugins=(git zsh-autosuggestions)
Enter fullscreen mode Exit fullscreen mode

Step 3: Apply the Changes

Finally, I reloaded my Zsh configuration to activate the plugin:

source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Now, I get helpful command suggestions as I type, which has sped up my workflow significantly.


Installing and Configuring Powerlevel10k

Step 1: Install Powerlevel10k

For a visually stunning terminal, I installed Powerlevel10k by cloning its repository:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
Enter fullscreen mode Exit fullscreen mode

Step 2: Set Powerlevel10k as the Theme

I then updated my .zshrc file to set Powerlevel10k as my theme:

nano ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

I changed the theme line to:

ZSH_THEME="powerlevel10k/powerlevel10k"
Enter fullscreen mode Exit fullscreen mode

Step 3: Apply the Changes

After saving the file, I reloaded my Zsh configuration:

source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Step 4: Configure Powerlevel10k

The first time I loaded the theme, Powerlevel10k launched a configuration wizard that helped me customize my prompt. If the wizard didn’t start automatically, I could trigger it manually with:

p10k configure
Enter fullscreen mode Exit fullscreen mode

This wizard allowed me to set up a prompt that displays essential information, making my terminal both beautiful and highly functional.


Conclusion

With Oh My Zsh, Zsh Autosuggestions, and Powerlevel10k, I’ve turned my macOS terminal into a powerful and aesthetically pleasing workspace. These tools have enhanced my productivity, made my workflow smoother, and added a personal touch to my terminal sessions. If you’re looking to improve your terminal experience, I highly recommend trying these tools out for yourself.

Top comments (0)