Skip to main content

Install Oh My Posh

As I worked in Linux whit zsh and Oh-my-zsh I searched for some tool that allowed me to customize my PowerShell as in linux, I found Oh My Posh as the alternative for PowerShell of Oh-my-zsh.

Here are the steps to follow to install Oh My Posh and customize the PowerShell.

Install Dependencies

We need to install all the modules need it for run Oh my Posh First we need to install posh-git

Install-Module posh-git

Then we install PSReadLine

Install-Module PSReadLine -AllowPrerelease -Force

Install Oh My Posh

Then we can use chocolatey to install Oh My Posh with this command.

choco install oh-my-posh

This will install the tool with a default theme.

Then we will need to install the fonts used in Oh My Posh, for this you can use the next command oh-my-posh font install

It will show you the fonts available, chose which you like.
powershell ohmyposh fonts

And the make sure to set the PowerShell with that font. See how

Add to PowerShell profile

Now we will need to add the dependencies and configurations in the PowerShell profile file so all is ready when we open the terminal. If this step you can close the Admin PowerShell and use the normal one.

First open the file with this command

notepad $PROFILE

If you don't have a profile file created yet you can created it with this command

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

First will need to add the posh-git module to the file.

Import-Module posh-git

We close and open again the terminal and now we can check all the info about Oh My Posh.

Here are all the available themes that Oh My Posh offers. If you want to check how the themes will look like before installing you can runt his command and it will show you all the themes.

Get-PoshThemes

Now we should open again the profile file and add the theme we want to render, it his example is will be M365Princess

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\M365Princess.omp.json" | Invoke-Expression

Now when you open the terminal it will look like this if you choses the M365Princess theme.
powershell ohmyposh final

Sources

Oh My Posh
Oh My Posh Fonts
PowerShell profile