How To Fix Your zsh Prompt On macOS

Tired of a long prompt in zsh? Or worse, upgrading from macOS 10.14- with a customized bash prompt, and zsh is harshing your minimalist terminal vibe? Read on to find out how to fix it, and how to understand the steps you're going to take!

The Motivation

(skip this week's rant)

If you're anything like me, you were previously a physics tutor at your local community college. At this community college the physics department insisted on teaching students to write math equations for lab reports with an arcane software "MathType" which was only available for use by copying it off of a machine in the lab and onto your local. And (again β€” if you're anything like me) then you caught wind macOS 10.15 "Catalina" was breaking the compatibility with that dinosaur of a program.

This was, of course, unacceptable: Each semester without fail you needed to do a ~20 minute presentation on various occassions to divulge the spells (keyboard shortcuts) and potions (font settings) needed to craft beautifully typeset equations for lab reports than only two sets of eyes would ever view.

And so (if you are a n y t h i n g like me) you opted to go without software updates for two years. That's right. You kept your production machine vulnerable to two years worth of juicy zero-day and known exploits, just to pass on the tradition of wizardry in a program that almost no one benefits from, and absolutely no one needs (ahem… LaTeX).

In any case, upon graduation you may have decided that having such a vulnerable machine while attending school online might not be the best course of action, and so you finally upgraded from OSX to the shiny, at the time new macOS "Big Sur". But, to your dismay, your terminal prompt was no longer the neat little folder emoji it once was. Now, despite your best efforts, you were being forced once more to STARE at your own name every time you wanted to access the command line. Disgusting.

Anyways, if yOu ArE aNyThInG LiKe mE, and you want to remedy the situation, let me guide you through the exercise:

How To:

  1. Open a new terminal at ~.
  1. view your current overrides for new zsh terminal environments with cat .zshrc.
  1. If you don't see anything that is going to change the prompt, cd to /etc and cat zshrc.
  1. You will see a # Default prompt line followed by
    PS1="%n@%m %1~ %# ". As I'm sure you can gather, this PS1 needs to be overriden in your ~/.zshrc.
  1. Copy the PS1 line with ⌘+C, and cd back to ~.
  1. nano .zshrc and paste in the PS1 line with ⌘+V, but don't exit yet.
  1. As I'm sure you can gather from observation, the "%n@" in the default prompt is the culprit of the clutter-tastrophy in your current prompt.

    If. You're. Anything. Like. Me. you don't care to see this info in one more solitary terminal environment, so swiftly delete these three offending characters.
  1. ^+O to save the changes, and ^+X to exit.

All done!

And that's all there is to it! Happy tuning out the noise.


Thanks to https://www.makeuseof.com/customize-zsh-prompt-macos-terminal/ for pointing me towards the correct directories.