Install PowerShell Core on the Mac

My ancient iMac, late 2012,  is still able to use the latest and greatest MacOS. At this writing, it is running MacOS Mojave 10.14.2, and I’m trying to install PowerShell Core 6.0 with Visual Studio Code on the machine.

PowerShell Core 6.0 is the open source cross-platform version of Microsoft PowerShell for Windows, and is available for Windows, Linux and the Mac.  In hindsight,  it might make more sense to test this all out on a Linux virtual machine before mucking up the MacOS.

The first thing to do is to install a package manager called Homebrew on to the Mac. This is the package manager which interfaces with GitHub to fetch the packages necessary for PowerShell.

Homebrew is available at: https://brew.sh    It gives you a command line to insert in the Mac terminal program which runs a script to fetch and install the Homebrew package manager.

Before pasting the command within the terminal prompt, you need to create a terminal session with “elevated” or root permissions.

Start Terminal

type su <your account name>   that is,  the command “su” and you’re user account.

You’ll be prompted for a password,  put in your Mac password.

On my machine this returns a prompt on the command line of bash-d.2$ At this point, I can paste the command below, and Homebrew will be installed.  The installation took about ten minutes.

Once the installation is complete,  you’ll see a message within the terminal:

Now that we have the package manager installed, we can go ahead and install Powershell

bash-3.2$ brew cask install powershell

This downloads the files from GitHub  Accoring to the prompts this will be version 6.1.

Once the packages are downloaded,  you’ll be prompted again for the root password:

and now, if you type pwsh you can start powershell which returns a prompt PS

type $psversiontable to see the current version.

Leave a comment