Oh My Posh update to non-module version
After my latest (not so) regular update of installed PowerShell modules, I was surprised by a breaking change in the Oh My Posh module. Fortunately, a link to an online migration guide was displayed directly in the terminal to get me started, but it still took me some time to get it working again.
It all started by running the following command to update all the PowerShell modules I have installed:
Update-Module
After restarting the PowerShell session, I was suddenly greeted with a friendly message instead of a working Oh My Posh setup:
Hey friend
In an effort to grow oh-my-posh, the decision was made to no longer support the PowerShell module. Over the past year, the added benefit of the module disappeared, while the burden of maintaining it increased.
However, this doesn't mean oh-my-posh disappears from your terminal, it just means that you'll have to use a different tool to install it.
All you need to do, is follow the migration guide here:
Of course, I started by following the uninstallation steps from the migration guide:
- I ran the following commands in my PowerShell session:
Remove-Item $env:POSH_PATH -Force -Recurse Uninstall-Module oh-my-posh -AllVersions
- And I removed the following lines from my PowerShell profile file:
Import-Module oh-my-posh Set-PoshPrompt -Theme negligible
Now, I was ready to install the Oh My Posh executable instead. First, I used Chocolatey to install it:
choco install oh-my-posh
Then I listed the installed themes to find the path to the one I used before:
ls $env:POSH_THEMES_PATH
Finally, I was ready to edit my PowerShell profile again and add the following line to it:
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\negligible.omp.json" | Invoke-Expression
After I restarted my PowerShell session, I was back to my original working configuration. It was time to repeat the process on my other computers.
Of course, nobody is ever happy when a supposedly quick and simple update process turns into something more time-consuming because of a breaking change. But at the very least, the migration process is well documented, and you don't even have to search for that documentation. Short of trying to automate the whole process, I don't think it could have been done any better.