Introduction

Over the years I have customised my shell prompt to make it "cool" and "informative". Previously I have used powerline and powerlevel10k. Both were pretty nice, with powerlevel10k being the much faster of the two.

I recently came across the Starship project which looks pretty rad. Starship prompt is "The minimal, blazing-fast, and infinitely customizable prompt for any shell!"

This post will cover getting Starship prompt installed and configured for MAC-OSX Catalina and iTerm2 for the zsh shell.

Installation

First you need to install some powerline patched fonts.

cmd

git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh

# Output
Copying fonts...
Powerline fonts installed to /Users/bradmin/Library/Fonts"

# Clean up
cd ..
rm -rf fonts
    

Install Starship with Homebrew.

cmd

brew install starship
    

Initialise Starship by adding the following to your ~/.zshrc and restarting your shell.

file

# ~/.zshrc
eval "$(starship init zsh)"
    

Configuration

Configure iTerm2 to use a Powerline Font.

Starship uses TOML for its configuration data. Create a starship.toml configuration file.

cmd

mkdir -p ~/.config && touch ~/.config/starship.toml
    

The prompt is configured via "modules". The docs outline the options for each module quite well. A sample configuration file can be found below.

file

# Replace the "❯" symbol in the prompt with "❯❯"
[character]
format = "❯❯ "
success_symbol = "❯❯(bold green) "
error_symbol = "❯❯(bold red) "

# Disable the package module, hiding it from the prompt completely
[package]
disabled = true

# Disable the AWS module.
[aws]
disabled = true

# Set the time format
[time]
disabled = false
time_format = "%Y-%m-%d %H:%M:%S"
utc_time_offset = "+10"

# Directory setttings
[directory]
format = "[$path]($style)[$read_only]($read_only_style) "
truncation_length = 4
truncate_to_repo = false
truncation_symbol = "…/"

[username]
disabled = true

[hostname]
ssh_only = false
format =  "[$hostname](bold red) ❯ "

# Workaround for slow prompt with git status
[git_status]
disabled = true
    

The result is a really nice looking, responsive and informative prompt.

cmd

~
2020-05-18 18:41:46 ❯❯
    

Troubleshooting

I found having the git_status module was causing the prompt to respond really slowly. I disabled this module and the response time went back to normal. There is an open issue for this and hopefully it will be resolved in a future release.

Summary

The Starship prompt looks like it does what it says on the tin. It's fast, easily customisable and looks great.

Updated: 20th November 2020

shell