Set up a fast cross-shell prompt with starship
Install starship, load it in bash, zsh or fish, edit starship.toml, apply a preset, and fix slow prompts or missing Nerd Font glyphs.
Updated
in short
Install the starship binary, add one starship init line to the end of your shell's rc file, then change the prompt in ~/.config/starship.toml. The same config file works in every shell you use.
starship is a single binary that prints your prompt. Each shell calls it before drawing the prompt, so bash, zsh and fish share one config file instead of three separate prompt scripts.
This guide installs it, loads it in your shell, walks through the config file and presets, and covers the two problems people hit most: a slow prompt and boxes or question marks where icons should be.
Tools used
Before you start
- bash, zsh or fish (starship also supports nushell, PowerShell, elvish, tcsh, xonsh and others)
- A Nerd Font installed and selected in your terminal, or use the
no-nerd-fontpreset in step 5 - A package manager such as Homebrew, pacman, dnf, winget or Scoop, or
curlfor the install script
Steps
Step 1: Install starship
Use your package manager if it has the package. On Linux and macOS the project's install script downloads the latest release; it only uses
sudowhen the target directory is not writable. Pass-b ~/.local/binto install without root.sh# macOS or Linux with Homebrew brew install starship # Arch Linux sudo pacman -S starship # Any Linux or macOS, official install script curl -sS https://starship.rs/install.sh | shshstarship --versionStep 2: Load starship in your shell
Add the line for your shell to the end of its rc file. It has to come after anything else that sets the prompt, such as a framework theme, or that code will overwrite it.
bash# ~/.bashrc eval "$(starship init bash)"zsh# ~/.zshrc eval "$(starship init zsh)"fish# ~/.config/fish/config.fish starship init fish | sourceStep 3: Open a new shell
Start a new terminal tab, or run
exec $SHELLto replace the current shell. You should see the default prompt: the current directory, git branch and status when inside a repository, language versions when the directory contains matching project files, and a❯character that turns red after a failed command.Step 4: Create starship.toml
starship works without a config file. To change anything, create
~/.config/starship.toml. Top-level keys apply to the whole prompt; each[section]configures one module. The$schemaline gives editors completion and validation for the file.This example removes the blank line between prompts, changes the prompt character, shows more of the path and hides the package version module.
shmkdir -p ~/.config && touch ~/.config/starship.tomltoml"$schema" = 'https://starship.rs/config-schema.json' # No blank line between prompts add_newline = false [character] success_symbol = '[➜](bold green)' error_symbol = '[✗](bold red)' [directory] # Default is 3 parent folders truncation_length = 5 [package] disabled = trueStep 5: Start from a preset
Presets are complete config files that ship inside the binary.
starship preset --listprints their names, and-owrites one to a file. Writing a preset replaces your config, so move an existingstarship.tomlaside first.nerd-font-symbolsuses Nerd Font icons for every module.no-nerd-fontonly uses emoji and powerline symbols, so it renders without a Nerd Font.plain-text-symbolsuses no icons at all.shstarship preset --listshmv ~/.config/starship.toml ~/.config/starship.toml.bak starship preset nerd-font-symbols -o ~/.config/starship.tomlStep 6: Use a different config path (optional)
To keep the file somewhere else, for example in a dotfiles repository, set
STARSHIP_CONFIGbefore thestarship initline.shexport STARSHIP_CONFIG=~/dotfiles/starship.toml
Troubleshooting
- Prompt is slow to appear: run
env STARSHIP_LOG=trace starship timingsin that directory. It lists every module that took over 1ms or printed output, so you can see which one to disable. Executing command "..." timed outwarnings: a module's command took longer thancommand_timeout(500 ms by default). Raise it at the top ofstarship.toml, or setSTARSHIP_LOG=errorto hide the warnings.- Slow
git_statusin WSL under/mnt/c/: the module is slow on Windows drives. Setdisabled = trueunder[git_status], or point itswindows_starshipoption at a Windows starship binary. - Large repositories or slow disks: lower
scan_timeout(default 30 ms), the time starship spends scanning the current directory for project files. - Boxes or question marks instead of icons: your terminal is not using a Nerd Font. Install one and select it in the terminal's font settings, or switch to the
no-nerd-fontpreset. - Glyphs still missing with a Nerd Font set: check that your locale is UTF-8 and an emoji font is installed.
echo -e "\xee\x82\xa0"should print a branch symbol. - Prompt did not change: another line later in the rc file resets the prompt. Move the
starship initline to the very end.
Tips
starship explaindescribes each module currently shown in your prompt, useful when you see a symbol you do not recognise.env STARSHIP_LOG=trace starship module git_statusruns one module on its own with debug logs.- Every module has a
disabledoption, so you can turn off anything you do not need.
Also worth a look
FAQ
- Do I need a Nerd Font to use starship?
- No, but the default config uses some Nerd Font symbols. Without one, apply the no-nerd-font or plain-text-symbols preset so every symbol renders.
- Can I use the same config on several machines and shells?
- Yes. The prompt is defined only in starship.toml, so copying that file, or pointing STARSHIP_CONFIG at a synced copy, gives the same prompt in every supported shell.
- How do I remove starship?
- Delete the starship init line from your rc file, then uninstall it with your package manager. If you used the install script, remove the binary with rm "$(command -v starship)".