Customize Mac Terminal (MAX POG FACTOR) P2
The Bash Prompt
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.
This can be done:
- Manually: https://scriptim.github.io/bash-prompt-generator/
- The pog way: STARSHIP
Nah not that… more like this (pog scale slowly rising here)
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.
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/