Windows Terminal is a modern, feature-rich terminal application for command-line users that includes many of the features you might need. But for those who want an enhanced terminal experience, Oh My Posh offers the ability to include a prompt theme engine for PowerShell that can add color, glyphs, and a lot of customizability to your command-line interface. In this guide, we will walk through the steps of installing PowerShell (if you haven’t already), downloading a Nerd Font, and setting up Oh My Posh to customize your terminal experience.
Step 1: Install PowerShell
Before we can get started with Oh My Posh, ensure you have the latest version of PowerShell installed. Here’s how you can do it using the Windows package manager winget:
winget install --id Microsoft.PowerShell --source winget
Step 2: Download and Install a Nerd Font
Oh My Posh uses Nerd Fonts to display glyphs (icons) in your prompt. Here’s how to set it up:
- Visit Nerd Fonts and download any font you perfer, Iam using the ‘Caskaydia Cove Nerd Font’.
- Unzip the downloaded font file.
- Copy and paste the unzipped font files into the System Font folder: C:\Windows\Fonts.
Step 3: Configure Your Terminal to Use the Nerd Font
After installing the font, you’ll need to tell Windows Terminal to use it:
- Re-open your terminal.
- Navigate to ‘Settings’ > ‘PowerShell’ > ‘Appearance’ > ‘Text’ > ‘Font Face’.
- Change the font that you downloaded in step 2.
Step 4: Install Oh My Posh
Now it’s time to install Oh My Posh itself:
winget install JanDeDobbeleer.OhMyPosh -s winget
Step 5: Create Your PowerShell Profile
You need to create a PowerShell profile if you don’t have one already. This script will run every time you open PowerShell:
New-Item -Path $profile -Type File -Force
This command will create a Microsoft.PowerShell_profile.ps1 file in the directory C:\Users{YourUserName}\Documents\PowerShell.
Step 6: Set Up Your Oh My Posh Theme
- Copy the omp.json file to your PowerShell directory (from Step 5). Named it {your-theme}.omp.json and you can customize it later.
- Open Microsoft.PowerShell_profile.ps1 with a text editor.
- Add the following line to configure Oh My Posh with your preferred theme and save the file:
oh-my-posh init pwsh --config C:\Users\{YourUserName}\Documents\PowerShell\{your-theme}.omp.json | Invoke-Expression
Replace {your-theme}.omp.json with the name of your Oh My Posh theme file.
With Oh My Posh and a Nerd Font installed, your PowerShell terminal will now display with the chosen theme each time you open it. Enjoy the new, personalized look of your terminal!