Customize Mac Terminal (MAX POG FACTOR) P2

The Bash Prompt

Zac the Wise
3 min readSep 19, 2022

Last blog got 2 claps, a success I didn’t expect so now, I present to you, the MAX POG FACTOR Bash prompt.

Your ‘prompt’, is basically the thing to the left of the cursor, it doesn’t highlight text, it simple adds color and poggy information to your terminal.

My Bash prompt
A ZSH prompt (more on that in the next blog)

This can be done:

  1. Manually: https://scriptim.github.io/bash-prompt-generator/
  2. The pog way: STARSHIP
STARSHIP?

Nah not that… more like this (pog scale slowly rising here)

Starship default theme w/ Gogh ‘brogrammer’ theme. The red symbols are related to the git status of the repo

LET’S GET IT

curl -sS https://starship.rs/install.sh | sh
nano ~/.bashrc

Add this to the bottom of your /etc/profile(this is for when you open a new terminal window) file.
eval "$(starship init bash)"

Also add it to your ~/.bashrc this is triggered when type bash after opening a new terminal session.

If this seems enigmatic read this https://apple.stackexchange.com/a/13019

Now when you open a new terminal you will be greeted with the default starship theme. WE’RE NOT DONE YET THOUGH.

STEP TWO:

Install a nerd font https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/CascadiaCode.zip.

Once installed the font, double click and install it. Then go to your Terminal Preferences and make it the terminal’s font.

VOILA baby.

The default config can be changed by creating a file called ~/.config/starship.toml.
More info here and here (sorry GenZ reading required here)

For my own bash prompt, after the novelty of Starship wore off I settled for a vanilla bash prompt that I customised to my liking.

Note how the git branch is displayed only in git repos

To achieve this beautiful prompt I used the prompt-generator aforementioned with the following in my /etc/profile

build_prompt () {
PS1='\[\e[0m\]Zacs-Macbook-Pro:\[\e[0;38;5;148m\]\W\n\[\e[0m\]\$ \[\e[0m\]'
git_info=$(git rev-parse --is-inside-work-tree 2>/dev/null)
if [ "$git_info" = "true" ]; then
branch=$(git branch)
PS1='\[\e[0m\]Zacs-Macbook-Pro:\[\e[0;38;5;148m\]\W\[\e[0m\] ➜ \[\e[0;38;5;170m\]$(git branch 2>/dev/null | grep '"'"'^*'"'"' | colrm 1 2)\n\[\e[0m\]\$ \[\e[0m\]'
fi
}
PROMPT_COMMAND=build_prompt

Alright bois n gals, that’s it for today.

Remember:

Discrod for insults and help: Zac the Wise#1381
Github for stars and curiosity: https://github.com/TechWiz-3/

--

--

Zac the Wise

A Python and Bash scripter. Passionate about the cloud, interested in robotics and obsessed with beautiful TUI’s