DEV Community

S.M. Khalid Mahmud
S.M. Khalid Mahmud

Posted on

How to Install Oh My Posh in Windows

Table of Content

Installation

First, you need to install the Powershell from Microsoft Store. After that, go to the Powershell terminal to run the below command and then restart the terminal.

Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))
Enter fullscreen mode Exit fullscreen mode

Activation

Now you need to initialize the Profile. So, the first thing you need to do is run the following command and check its path:

echo $profile
Enter fullscreen mode Exit fullscreen mode

After that, you will need to create the profile manually using the above getting path, and an editor will need to open the file where the following line must be added:

oh-my-posh --init --shell pwsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$(oh-my-posh --version)/themes/jandedobbeleer.omp.json | Invoke-Expression
Enter fullscreen mode Exit fullscreen mode

Now press Ctrl + S. And the last one is, if you want to set beautiful terminal icons, then add the following line in the profile also (Optional):

Import-Module -Name Terminal-Icons
Enter fullscreen mode Exit fullscreen mode

Then, install the terminal icons module using the below command and restart the terminal.

Install-Module -Name Terminal-Icons -RequiredVersion 0.9.0
Enter fullscreen mode Exit fullscreen mode

Install Nerd Font

You need to use Nerd Font to display all the nice custom icons. You can download them directly from here. Just save them on your computer, unzip and install them and you need to set this font from terminal settings.

Change the Theme

If you want to change your current theme, then open your Profile Script by running the below command:

notepad $profile
Enter fullscreen mode Exit fullscreen mode

Now, scroll to where you added your Theme Config and replace the old theme name with the new theme name.

oh-my-posh --init --shell pwsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$(oh-my-posh --version)/themes/night-owl.omp.json | Invoke-Expression
Enter fullscreen mode Exit fullscreen mode

Now press Ctrl + S. Then restart the terminal.

Top comments (0)