powershell - oh-my-posh windows terminal first time installation issues & solution - Stack Overflow

I was customizing my Windows Terminal for my new PC from scratch. I ran into a couple of issues install

I was customizing my Windows Terminal for my new PC from scratch. I ran into a couple of issues installing oh-my-posh, first from this 3rd party tutorial and later when following the official docs.

The final steps/corrections I used are in the answer below.

I was customizing my Windows Terminal for my new PC from scratch. I ran into a couple of issues installing oh-my-posh, first from this 3rd party tutorial and later when following the official docs.

The final steps/corrections I used are in the answer below.

Share Improve this question asked Mar 25 at 20:30 MrCuriousMrCurious 414 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

(We're assuming you're using Windows Terminal and Powershell)

You'll have to replace <user> in the paths below with your username

(running $Env:UserName in Powershell will print this)

  1. Install a compatible nerd font like FiraCode so you can see the cool icons

    1. Unzip the file and double-click the Windows-compatible font to install
  2. Update this font to be your PowerShell default by

    1. Opening Windows Terminal in Administrator mode (for later commands)

    2. Opening Settings (Ctrl-Comma)

    3. On the far left select Profiles -> Windows Powershell -> Additional Settings -> Appearance -> Font Face -> Fira Code (or whatever nerd font you selected)

    4. Hit the save button at the bottom right

    5. Navigate back to the terminal and

    6. Restart your admin terminal either via:

      1. Closing and reopening or

      2. Ctrl-Shift-P (open command palette) -> Restart Connection

  3. Install OhMyPosh, which, for me, meant running the following in my admin Powershell

1. `winget install JanDeDobbeleer.OhMyPosh -s winget`

2. Winget should already be installed in newer Windows versions, but [installation instructions are here](https://www.powershellgallery/packages/winget-install/2.1.0)

3. This also added the oh-my-posh bin to my PATH

4. Restart your admin terminal
  1. Allow Powershell to run local scripts via

    1. Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

    2. Theoretically you can also sign the profile if you don't want to run the former

  2. Create a powershell profile (I didn't have one by default)

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

    2. My file was created in this directory:

      1. C:\Users\<user>\Documents\WindowsPowerShell
  3. Open your powershell profile file in notepad via

    1. notepad $PROFILE
  4. Enter the following in notepad

    1. & "C:\Users\<user>\AppData\Local\Programs\oh-my-posh\bin\oh-my-posh.exe" init pwsh | Invoke-Expression

    2. The original command from the docs looks like it was made from cmd rather than powershell, and failed when I tried to run it

      1. oh-my-posh init pwsh | Invoke-Expression
  5. Save the file and close it

  6. Reload the profile via

    1. & $PROFILE

    2. The original command from the docs looks like it was made from cmd rather than powershell, and failed when I tried to run it

      1. . $PROFILE
  7. Done! If all went well you should see oh-my-posh run on terminal startup!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744170094a4561494.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信