With the introduction of Catalina, macOS now uses Zsh by default. After only a few months, I finally took some time to re-create my preferred command prompt with timestamps. Zsh is actually able to render this a little more elegantly than Bash, with explicit support for right-aligned prompts:

As you can see in the screenshot, I’ve updated it to also include the current git branch if you’re in a git repository. Simply add the following to ~/.zshrc:

autoload -Uz vcs_info
precmd_functions+=( vcs_info )
zstyle ':vcs_info:git:*' formats '%F{magenta}%b%f '
zstyle ':vcs_info:*' enable git
setopt prompt_subst
PROMPT="%[email protected]%m %1~ \$vcs_info_msg_0_%# "
RPROMPT="%F{250}$( date "+%H:%M:%S %Z" )%f"

June 6, 2020: I had previously suggested that any Zsh configuration file could be used, but Michael has informed me that ~/.zshrc is the correct file to use when configuring an interactive shell. You can find a more in-depth discussion of this at Scripting OS X.

November 26, 2020: I’ve noticed the timestamp in RPROMPT wasn’t updating (the date command was being run only once when starting Zsh). Reading around, I’ve learned Zsh natively supports the %D format specifier for dates, making everything much easier. I’ve also found it’s more useful to have the hostname in the right prompt (%m), bringing the updated prompt to be:

PROMPT="%n %1~ \$vcs_info_msg_0_%# "
RPROMPT="%F{250}%m %D{%H:%M:%S %Z}%f"

You can find the latest version on GitHub.