How to set an emoji as Zsh terminal prompt in macOS

Custom Zsh Prompt macOS

It would be so much fun to update the Zsh Shell default prompt from a % sign to something that you like, say an unicode emoji/smiley - like a butterfly, batman, spiderman, or any other special symbol? Well this is possible, all you need to do is set the PROMPT variable in .zshrc file.

By default the .zshrc profile file is not available on macOS, you need to create it, try the below command, and it will create the file for you if does not exists.

% nano ~/.zshrc

This will open up the file in nano editor (you may use vi/vim if you prefer), just add the below lines at the start of the file,

 🦋 '
Adding custom Prompt to zshrc file
Adding custom Prompt to zshrc file

Now press Ctrl + X to exit and Y to save, and press Enter. Now to reflect these updates, you run the below command,

% source ~/.zshrc

That's it! You should see the butterfly emoji now as the new Zsh prompt.

If you wish to go back to the normal prompt for zsh, simply open the same file again and remove the line we just added.

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap