homebrewpowershell-coremacos-sonoma

Upgraded PowerShell using brew but it hasn't upgraded


Today, I started pwsh on my M2 Mac. It started 7.4.0 and told me an update was available. I'm pretty new to MacOS. I tried brew upgrade powershell and it said something about it not being installed with brew, I think. I can't remember how I installed it - it was when I first got the MacBook. I assumed I'd installed it before I found out about brew so I thought I should uninstall it and then reinstall it using brew. I tried following the uninstall instructions for a direct install. It didn't seem to do anything. I tried various things - honestly, headless chicken doesn't really describe it - I didn't keep notes. I just wanted it done so I could get on with what I wanted to use PowerShell for.

tl;dr

I've tried:

brew update
brew upgrade powershell

Currently, pwsh still starts 7.4.0.

If I try to see what's installed, I get:

9:56:17 ~ $ brew list powershell --cask
==> Pkg
powershell-7.4.4-osx-arm64.pkg (Pkg)

Before I found that command, I tried this:

9:56:28 ~ $ brew list powershell       
Warning: Treating powershell as a formula. For the cask, use homebrew/cask/powershell or specify the `--cask` flag.
/opt/homebrew/Cellar/powershell/7.4.0/bin/pwsh
/opt/homebrew/Cellar/powershell/7.4.0/libexec/Modules/ (90 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/Schemas/ (53 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/_manifest/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/cs/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/de/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/en-US/default.help.txt
/opt/homebrew/Cellar/powershell/7.4.0/libexec/es/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/fr/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/it/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/ja/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/ko/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/pl/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/pt-BR/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/ref/ (163 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/ru/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/tr/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/zh-Hans/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/zh-Hant/ (4 files)
/opt/homebrew/Cellar/powershell/7.4.0/libexec/ (254 files)
10:02:33 ~ $ 

Help!


Solution

  • Once you follow the documentation from Microsoft, then the powershell formula will be installed from powershell/tap and I highly suspect that you have done this before. After this, you also could install the powershell cask from the official Homebrew repo, homebrew/cask.

    Try to remove the unused powershell formula,

    brew uninstall powershell/tap/powershell
    

    and reinstall the cask to link the binary correctly,

    brew reinstall --cask powershell
    

    and check the version again.