The latest version of macOS uses zsh as the shell. To change the prompt in the Terminal we can do the following.

  1. Install oh-my-zsh which provides many enhancements to the zsh.
  2. Install spaceship theme.
npm install -g spaceship-prompt
  1. Set the theme to spaceship and the prompt symbol to λ from the default % by add the below in the .zshrc file
ZSH_THEME="spaceship"
SPACESHIP_CHAR_SYMBOL='λ '
# Set Spaceship ZSH as a prompt
autoload -U promptinit; promptinit
prompt spaceship
  1. Source the configuration source ~/.zshrc or relaunch the terminal. The prompt will be updated.