DEV Community

Cover image for Adding an Octopus to the Zsh Prompt
Joyce Lin
Joyce Lin

Posted on • Originally published at Medium on

Adding an Octopus to the Zsh Prompt

Transition from bash to zsh with custom settings, emojis, and git prompt

For my last Mac, I had a friendly hamster face emoji in my terminal bash prompt. After I recently upgraded to a new Mac, I discovered Apple has replaced bash with zsh as the default shell, beginning with macOS Catalina.

Starting with macOS Catalina, your Mac uses zsh as the default login shell and interactive shell.

You can still switch back to bash, for now, but the trend is moving to zsh as the command-line interpreter for the login shell and interactive shell.

Here’s how you can add an Octopus emoji and other custom items to your zsh prompt to make life in your terminal more hospitable.

Change your default shell

If you aren’t already using zsh in your terminal, change the shell by updating the shell path to /bin/zsh, with the following terminal command.

$ chsh -s /bin/zsh
Enter fullscreen mode Exit fullscreen mode

Switch to a zsh profile and prompt

Zsh recognizes a different set of prompt specifiers than bash, so you may need to modify some settings previously used in your bash profile.

If you’re starting from scratch, here’s 3 steps to add a custom prompt with an emoji as well as other information about the current git repository.

Step 1: clone the repo

To add a git prompt for zsh, clone this repo somewhere on your hard drive.

$ git clone [https://github.com/olivierverdier/zsh-git-prompt.git](https://github.com/olivierverdier/zsh-git-prompt.git)
Enter fullscreen mode Exit fullscreen mode

Step 2: source the zsh file from your config

Source the file zshrc.sh from your ~/.zshrc config file by referencing the path to where you installed zshrc.sh in the preceding step.

# in ~/.zshrc

source path/to/zshrc.sh
Enter fullscreen mode Exit fullscreen mode

Step 3: configure the prompt

Configure the prompt in the ~/.zshrc config file. Replace my Octopus by pasting in your own emoji, or use Ctrl + Cmd + Space on Mac to open up the emoji keyboard.

# in ~/.zshrc
# an example prompt

PROMPT='🐙 %~ $(git\_super\_status) '
Enter fullscreen mode Exit fullscreen mode

This is what my config file looks like, referencing the location where I installed zshrc.sh, and with my personal preferences for a git prompt. For additional customization, update the PROMPT string. You can use a zsh prompt generator to easily configure, bold, or colorize even more elements.

zsh config file

Save your changes, and open a new terminal tab to inspect your newest Octopus friend.

zsh terminal

Top comments (0)