Skip to main content

PowerShell

info

This guide is for usage inside PowerShell only. If you plan to use Oh My Posh inside other shells as well, have a look at the platform specific install instructions.

Installation#

Install-Module oh-my-posh -Scope CurrentUser
caution

If you wish to install for all users in a linux environment, you will need to install from an elevated PowerShell session. You will also need to import the module one time from the elevated session in order to set the executable permissions correctly.

sudo pwsh
Install-Module oh-my-posh -Scope AllUsers
Import-Module oh-my-posh

List all themes#

To display every available theme in the current directory, use the following cmdlet.

Get-PoshThemes

The module installs all themes in the module folder. To find the actual files, you can use the following command:

Get-PoshThemes -list

Replace your existing prompt#

Edit $PROFILE in your preferred PowerShell version and add the following line. Autocompletion is available so it will loop through all available themes.

Set-PoshPrompt -Theme jandedobbeleer

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

. $PROFILE

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.

Set-PoshPrompt -Theme ~/.mytheme.omp.json

Update#

Update-Module oh-my-posh

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