Skip to main content

macOS

Setup your terminal#

As the standard terminal has issues displaying the ANSI characters correctly, we advise using iTerm2 or any other modern day MacOS terminal that supports ANSI characters.

Installation#

A Homebrew formula is available for easy installation.

brew tap jandedobbeleer/oh-my-posh
brew install oh-my-posh

This installs two things:

  • oh-my-posh - Executable, added to /usr/local/bin
  • themes - The latest Oh my Posh themes

If you want to use a standard theme, you can find them in $(brew --prefix oh-my-posh)/themes, referencing them as such will always keep them compatible with the binary when updating Oh my Posh.

Preview the themes#

for file in $(brew --prefix oh-my-posh)/themes/*.omp.json; do echo "$file\n"; oh-my-posh --config $file --shell universal; echo "\n"; done;

Update#

brew upgrade oh-my-posh

Replace your existing prompt#

info

If you have no idea which shell you're currently using, Oh my Posh has a utility switch that can you tell you (not relevant for the Powershell module).

oh-my-posh --print-shell

Edit $PROFILE in your preferred PowerShell version and add the following line.

Invoke-Expression (oh-my-posh --init --shell pwsh --config ~/mytheme.omp.json)

Once added, reload your profile for the changes to take effect.

. $PROFILE

Customize#

At this point you're good to go. The jandedobbeleer.omp.json theme displays most common use-cases in your prompt so 9/10 you'll be more than happy with it. However, if you want to explore additional functionality, going through the additional steps below will help you get started.

Change the theme#

We downloaded all the themes and set jandedobbeleer.omp.json as the one to use. However, there are a lot more to be discovered and maybe there are some you like better.

Override the theme settings#

Maybe there's a theme you like, but you don't fancy the colors. Or, maybe there's a segment you want to tweak/add, or replace some of the icons with a different one. Whatever the case, read through all available options first, by starting with the configuration guide.

You can output the current theme to the format you like (json, yaml or toml) which can be used to tweak and store as your custom theme.

Export-PoshTheme -FilePath ~/.mytheme.omp.json -Format json

Once you're done editing, adjust your $PROFILE to use your newly created theme.

Invoke-Expression (oh-my-posh --init --shell pwsh --config ~/mytheme.omp.json)

๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰