Icons not showing in powershell after installing posh-git

5.3k Views Asked by At

Today I installed posh-git in the PowerShell but the icons are not showing instead showing a rectangle box with a question mark inside. Below are the steps I followed to:

Install-Module oh-my-posh -Scope CurrentUser

then

Install-Module posh-git -Scope CurrentUser

For both packages, I have selected the Yes To All option.

After installing the packages, I opened Microsoft.PowerShell_profile.ps1 file and added the following snippet:

Import-Module oh-my-posh
Import-Module posh-git

Set-PoshPrompt -Theme M365Princess
# M365Princess is the theme name I found from oh-my-posh doc

After this in the VS Code settings.json I added this "terminal.integrated.fontFamily": "Fira Code".

FYI, I have installed the Fira Code Medium Nerd Font Complete Windows Compatible font already.

Then restarted by VS Code. Color is showing perfectly and also some icons but also some are missing like the example in the below screenshot.

Posh Git

Please help me out with how I can solve this.

3

There are 3 best solutions below

2
Jan De Dobbeleer On

Two things, first, do not use the module anymore as that's no longer supported. More info here. Secondly, set the correct font so the icons can render, as that's why you see

0
lazy firos On
3
Juan Paulo Pérez-Tejada On

I was leading with the same problem. This solved it for me.

Install one of the nerd fonts recommended by oh-my-posh

oh-my-posh font install # Add --user if you're not running as administrator

Once that they are installed, you should change the properties of the command shell. For example, I selected Meslo font. In windows terminal, you change the settings.json and add:

{
    "profiles":
    {
        "defaults":
        {
            "font":
            {
                "face": "MesloLGM Nerd Font"
            }
        }
    }
}

In PowerShell, you go to properties > fonts and select one of nerd fonts.

If you need to charge the profile again, you can do it with . $PROFILE.