Oh My Posh is a prompt theme engine: it turns your PowerShell prompt into one that shows the folder, the Git branch and status, whether the last command failed, and more. To set it up on Windows: install it with winget, install a Nerd Font, then add one line to your PowerShell profile.
If you followed an older guide that used Set-Theme, that was Oh My Posh version 2, the PowerShell module, which this post originally covered. That module is deprecated and Set-Theme is not part of the current version. Everything below is the current way.
Install Oh My Posh
winget install JanDeDobbeleer.OhMyPosh -s winget
Close and reopen your terminal afterwards so the new oh-my-posh command is on your PATH.

Close and reopen your terminal afterwards so the new oh-my-posh command is on your PATH.
Install a Nerd Font
Most themes use icons that only show in a Nerd Font, otherwise you get empty boxes. Oh My Posh can install one for you:
oh-my-posh font install meslo
Then set it in Windows Terminal: Settings > Profiles > Defaults > Appearance > Font face, and pick MesloLGM Nerd Font.
Turn It On in Your Profile
# open your PowerShell profile (creates it if it does not exist)
if (-not (Test-Path $PROFILE)) { New-Item -Path $PROFILE -ItemType File -Force }
notepad $PROFILEAdd this line to the profile, save it, and open a new PowerShell window:
oh-my-posh init pwsh | Invoke-Expression
More on finding and editing the profile is in Find and Edit Your PowerShell Profile. If the new window says running scripts is disabled, the execution policy is blocking your profile: Fix “.ps1 cannot be loaded”.
Pick a Theme
The themes ship with Oh My Posh. To use one, point the same line at its file, here the Zash theme I used in 2020:
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\zash.omp.json" | Invoke-Expression
Here is Zash as it looked when I first set it up, with the Git status segments showing in a repository:


All the themes, with previews, are in the Oh My Posh theme gallery. Git status in the prompt works on its own now, so posh-git is no longer needed for it, though it is still worth having for Git tab completion: How to Install posh-git on Windows.
Leave a Reply