bo3bdo Blog

Back

oh my posh

Published 8 months ago 2 min read 95 comments 2 min read PowerShell

Windows

Set up your terminal

While Oh My Posh works on the standard terminal, we advise using the Windows Terminal.


Installation

  • winget

Open a PowerShell prompt and run the following command:

winget install JanDeDobbeleer.OhMyPosh -s winget

When the above command gives an error, make sure to create the profile first.

New-Item -Path $PROFILE -Type File -Force

Then add the following line.

oh-my-posh init pwsh | Invoke-Expression

Install-Module PSReadLine -AllowPrerelease -Force

If you want the latest, otherwise remove the Prerelease. Then edit your $profile. I usually do this:


notepad $PROFILE
And add


if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}

Is your prompt

not extra enough? That's because your directory listing needs color AND cool icons!

Install-Module -Name Terminal-Icons -Repository PSGallery

And then add one line to my $profile (edit with "code $profile"):

Import-Module -Name Terminal-Icons

notepad $PROFILE

oh-my-posh init pwsh --config 'C:\Users\bo3bd\AppData\Local\Programs\oh-my-posh\themes\patriksvensson.omp.json' | Invoke-Expression if ($host.Name -eq 'ConsoleHost') { Import-Module PSReadLine }