Customizing MacOS Terminal with Starship Like a Pro
Source: Dev.to
Install Starship
brew install starship
Edit your Zsh configuration:
nano ~/.zshrc
Add the following line to load Starship on every Zsh session:
eval "$(starship init zsh)"
Optional plugins
These plugins enhance the terminal experience by highlighting commands in real time and providing suggestions based on your command history and current input.
brew install zsh-syntax-highlighting
brew install zsh-autosuggestions
Edit ~/.zshrc again and add the plugin load lines:
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
Install a Nerd Font
To ensure the terminal can correctly render icons and custom glyphs, install a Nerd Font:
brew search font-fira-code-nerd-font # verify availability
brew install --cask font-fira-code-nerd-font
Configure the terminal to use the Nerd Font
| Option | Value |
|---|---|
| Terminal Font | FiraCode Nerd Font |
VS Code settings (optional)
{
"terminal.integrated.fontFamily": "FiraCode Nerd Font",
"editor.fontFamily": "Menlo, Monaco, 'Courier New', monospace, 'FiraCode Nerd Font'"
}
Create the Starship configuration
mkdir -p ~/.config && nano ~/.config/starship.toml
Add the following content to starship.toml:
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'
format = """
$directory$git_branch$git_status$fill$aws$nodejs$java$gradle
$os$character
"""
[fill]
symbol = ' '
[directory]
format = '[ $path ]($style)[$read_only]($read_only_style)'
style = 'bg:blue'
read_only_style = 'bg:red'
truncate_to_repo = true
truncation_length = 1
[git_branch]
format = '[ $symbol$branch ]($style)'
style = 'bg:green'
[git_status]
format = '[$all_status$ahead_behind](bg:green)'
conflicted = '[ = ](bg:yellow bold)'
ahead = '[ ⇡ ](bg:yellow bold)'
behind = '[ ⇣ ](bg:yellow bold)'
diverged = '[ ⇕ ](bg:yellow bold)'
up_to_date = ''
untracked = '[ ? ](bg:yellow bold)'
stashed = '[ $ ](bg:yellow bold)'
modified = '[ ! ](bg:yellow bold)'
staged = '[ + ](bg:yellow bold)'
renamed = '[ » ](bg:yellow bold)'
deleted = '[ ✘ ](bg:yellow bold)'
typechanged = ""
[aws]
format = '[ $symbol $profile $region ]($style)'
symbol = ' '
[nodejs]
format = '[ $symbol $version ]($style)'
version_format = '${raw}'
[java]
format = '[ $symbol:$version ]($style)'
version_format = '${raw}'
style = 'bg:red bold'
symbol = 'jdk'
[gradle]
format = '[ $symbol $version ]($style)'
version_format = '${raw}'
symbol = ''
[os]
format = '[$symbol ]($style)'
disabled = false
[os.symbols]
Macos = ''
[character]
success_symbol = "[❯](bold default)"
error_symbol = '[✗](bold red) '
Using the prompt
AWS profile
Switch AWS profiles by setting the AWS_PROFILE environment variable:
export AWS_PROFILE=your-profile-name
The prompt will display the active AWS profile (e.g., root) and region (e.g., us-east-1).
Node.js
Open a terminal inside a Node.js project directory. Starship will show the active Node.js version, and it updates automatically when you change versions with tools like nvm:
nvm use 18
Git information (branch, status icons) is also displayed.
Java / Gradle
Open a terminal inside a Java project directory. The prompt will show:
- The active Java version.
- The active Gradle version.
- Any enabled AWS profile and region information.
Enjoy your customized, context‑rich terminal!