Monday, February 10, 2020

Change the default prompt in Terminal

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
3. Set the theme to spaceship and the prompt symbol to λ from the default % by add the below in the .zshrc file
# Set Spaceship ZSH as a prompt
autoload -U promptinit; promptinit
prompt spaceship
4. Source the configuration source ~/.zshrc or relaunch the terminal. We will have our updated prompt in the Terminal.