Easy way to colorify Your Shell Prompt Experience on The Mac
Published: 2023-09-15 06:31:42

Have you ever attended a developer conference and marveled at the colorful and eye-catching terminal prompts displayed by presenters? If you've wondered how to make your Mac terminal look equally cool and personalized, you're in the right place. In this guide, we'll walk you through the steps to colorify your shell prompt experience on macOS.


![Image11](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bzhh2ncktatkkx2yc8ym.png)

## The Concept

Traditionally, configuring your shell prompt involved either intricate custom scripts per theme or navigating a labyrinth of command-line configuration switches. It could be cumbersome and required a deep understanding of the underlying mechanisms.

Oh My Posh seeks to simplify this process by introducing a novel concept - a single configuration file that can be effortlessly shared across platforms and users. This approach eliminates the need for users to delve into the intricacies of prompt customization.

## Deconstructing the Prompt

If you've ever admired complex and aesthetically pleasing prompts like Agnoster or Paradox, you'd notice they share a common structure. They consist of a few fundamental building blocks, each housing one or more segments that display specific information.

The brilliance of Oh My Posh lies in its ability to deconstruct your prompt into these building blocks. These blocks, in turn, are composed of segments, and this hierarchy is mirrored in Oh My Posh's configuration.

In essence, you can think of your prompt as a carefully orchestrated symphony, where each block and segment plays a unique role in displaying vital information and enhancing your shell's functionality.

## Oh My Posh in Action

[Oh My Posh](https://ohmyposh.dev/ "Oh My Posh")'s approach to prompt customization simplifies the process for users while retaining the flexibility to create intricate and visually appealing prompts. Whether you're a seasoned shell aficionado or a newcomer looking to elevate your command-line experience, Oh My Posh offers a powerful and accessible solution.

With its innovative configuration model and focus on modular blocks and segments, Oh My Posh empowers users to craft personalized prompts that not only look great but also provide valuable insights and functionality.

In the world of shell customization, Oh My Posh is a game-changer, putting the power of prompt customization in the hands of all users, regardless of their level of expertise. So, if you're ready to transform your shell prompt into a work of art, Oh My Posh is here to help you achieve just that.

## Getting Started

### Install Homebrew

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

### Install iTerm


iTerm can now be installed with brew by running the following command:

```
brew install --cask iterm2
```


### Install Oh My Zsh

Zsh is the default shell that comes pre-installed on all macOS systems since macOS Catalina. Zsh works as an interpreter that translates your terminal commands into instructions for your operating system to run. Zsh on itself isn’t very powerful. To improve this, we will install Oh My Zsh which is a framework for managing your Zsh configuration. This will allow you to install plugins for your Zsh configuration.

To install Oh My Zsh, simply open up your terminal emulator of choice and run the following command:

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

Now that Oh My zsg is installed, you can go ahead and configure your terminal and shell to get the prompt to look exactly like you want.


### Install Oh My Posh

You can install the Oh My Posh theming engine with Homebrew by executing the following command:

```
brew install jandedobbeleer/oh-my-posh/oh-my-posh
```


### Install Font

Oh My Posh recommends installing Nerd Fonts. These fonts are patched to include beautiful icons which will be displayed in your terminal prompt. Fonts can be installed with the built-in Oh My Posh command.

```
oh-my-posh font install
```

After running this command, you will be prompted to select a specific font. 


![Image9](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ptgif9xde2259szwjpx.png)


We will choose Meslo, since Oh My Posh recommends this font for its theming engine.


```
eval "$(oh-my-posh init zsh --config $(brew --prefix oh-my-posh)/themes/M365Princess.omp.json)"
```

```
source ~/.zshrc
```


Don’t forget to rerun the command source ~/.zshrc to activate your changes.


![Image8](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0y5tgxfnnphjll32x0n1.png)

### Conclusion

With these simple steps, you've colorified your shell prompt on your Mac, giving it a personalized and eye-catching appearance.