• Install PowerShell on Mac

    Home » Forums » AskWoody support » Apple » Apple operating systems » macOS » Install PowerShell on Mac

    Author
    Topic
    #2159065

    A while back I read there’s a variant of PowerShell available for Mac. Does anyone have the instructions on the quickest way to install it? I may be spinning up an Office 365 tenant for testing purposes, and having PowerShell access on my Mac would be great.

    Thanks!

    Nathan Parker

    Viewing 5 reply threads
    Author
    Replies
    • #2169489

      PowerShell available for Mac

      There is a version for Mac here : https://github.com/PowerShell/PowerShell/releases/tag/v6.2.4

      1 user thanked author for this post.
    • #2169952

      For this week’s AskWoody Mac column, I’m going to comment back on this and elaborate on it.

      The instructions at the link above worked on both of my Macs. I’m going to consolidate the instructions here (since I needed to also install Homebrew for Mac) to make it easier for AskWoody members.

      I installed my copy of PowerShell Core for Mac through Homebrew for Mac, which was the easiest way to install it, and it’ll be the easiest way to keep it updated. Here are the instructions needed to install it using Homebrew for Mac:

      1. You’ll need to have the Xcode Command Line Tools installed. This can be done without installing the entire Xcode app. In Terminal, simply run: xcode-select –install
      2. Install Homebrew (which now also installs Homebrew Cask). In terminal, type: ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” More instructions here.
      3. Run this command in Terminal: brew doctor
      4. If you receive “Your system is ready to brew” in Terminal, you’re ready to install PowerShell.
      5. Run this command in Terminal to install PowerShell: brew cask install powershell

      Once installed, you can run the Terminal command pwsh to test to see if PowerShell loads, as well as PowerShell installs a nice PowerShell icon in your Applications folder in which clicking on it launches Terminal and automatically runs the pwsh command.

      To update PowerShell to any new releases, run the following commands in Terminal:

      1. The Homebrew Update command: brew update
      2. The PowerShell Update command: brew cask upgrade powershell

      Some PowerShell documentation I read said OpenSSL also needs to be installed using this Terminal command: brew install openssl. OpenSSL was already installed on both of my Macs.

      To remove PowerShell at any time, simply run this command in Terminal: brew cask uninstall powershell

      It feels good to have PowerShell on my Mac, so one less reason I have to fire up my work PC!

      Nathan Parker

    • #2300780

      The command brew cask upgrade is deprecated, so now I need to find the new command to update PowerShell.

      Nathan Parker

      • #2308763

        Nathan, I am running Mojave, as you know and, just now, I did the experiment of running “brew update” It run and reinstalled a number of items, probably installed some new ones too. Have not checked that yet.

        At the same time, there is this description of changes to Homebrew that come with the new version 2.5.0 :

        https://brew.sh/2020/09/08/homebrew-2.5.0/

        It says there that many of the “cask” commands have been deprecated and replaced with “brew” commands.

        I hope you find this helpful.

        Ex-Windows user (Win. 98, XP, 7); since mid-2017 using also macOS. Presently on Monterey 12.15 & sometimes running also Linux (Mint).

        MacBook Pro circa mid-2015, 15" display, with 16GB 1600 GHz DDR3 RAM, 1 TB SSD, a Haswell architecture Intel CPU with 4 Cores and 8 Threads model i7-4870HQ @ 2.50GHz.
        Intel Iris Pro GPU with Built-in Bus, VRAM 1.5 GB, Display 2880 x 1800 Retina, 24-Bit color.
        macOS Monterey; browsers: Waterfox "Current", Vivaldi and (now and then) Chrome; security apps. Intego AV

        1 user thanked author for this post.
    • #2303168

      Has anyone found the replacement command to “brew cask upgrade”?

      Nathan Parker

      • #2308764

        Nathan, have a look here:

        https://github.com/Homebrew/brew/pull/8239

        Good luck.

        Ex-Windows user (Win. 98, XP, 7); since mid-2017 using also macOS. Presently on Monterey 12.15 & sometimes running also Linux (Mint).

        MacBook Pro circa mid-2015, 15" display, with 16GB 1600 GHz DDR3 RAM, 1 TB SSD, a Haswell architecture Intel CPU with 4 Cores and 8 Threads model i7-4870HQ @ 2.50GHz.
        Intel Iris Pro GPU with Built-in Bus, VRAM 1.5 GB, Display 2880 x 1800 Retina, 24-Bit color.
        macOS Monterey; browsers: Waterfox "Current", Vivaldi and (now and then) Chrome; security apps. Intego AV

        1 user thanked author for this post.
    • #2308766

      So if I need to update PowerShell, do I run “brew update” or “brew update powershell”?

      Nathan Parker

      • #2308770

        Nathan, According to this:

        https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-macos?view=powershell-7

        it looks like you have to do this:

        brew update
        brew upgrade powershell –cask

        Or else just this, depending of which version it is:

        brew upgrade powershell

        Ex-Windows user (Win. 98, XP, 7); since mid-2017 using also macOS. Presently on Monterey 12.15 & sometimes running also Linux (Mint).

        MacBook Pro circa mid-2015, 15" display, with 16GB 1600 GHz DDR3 RAM, 1 TB SSD, a Haswell architecture Intel CPU with 4 Cores and 8 Threads model i7-4870HQ @ 2.50GHz.
        Intel Iris Pro GPU with Built-in Bus, VRAM 1.5 GB, Display 2880 x 1800 Retina, 24-Bit color.
        macOS Monterey; browsers: Waterfox "Current", Vivaldi and (now and then) Chrome; security apps. Intego AV

        1 user thanked author for this post.
    • #2308784

      Thanks. I ran them. I can’t tell if it updated powershell or not. Brew update did return some results, the powershell commands just returned a Terminal input command.

      Nathan Parker

    Viewing 5 reply threads
    Reply To: Install PowerShell on Mac

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: