Checking for PowerShell Core latest version in non-Windows Systems

I’m not sure who don’t get desperate to get the latest version of PowerShell Core when it becomes available. I do!
Sometimes I’m lucky enough to check Github PowerShell repository to find out it has been recently out.

But, this doesn’t means that is available in any of the other repositories! And, it may take a few more hours after it’s released. So, what would you do?

Repository Availability

Let’s take a look at how to check for PowerShell latest version on different non-Windows Systems.

Ubuntu:
apt-cache policy powershell #-> Or, powershell-preview

CentOS:
yum list powershell #-> Or, powershell-preview

MacOS:
## - Display installed current information.
brew cask info powershell

## - Seems when is current it will not display anything.
brew cask list powershell

## - Intended to show if app is outdated:
brew cask outdated powershell

MacOS Home Brew always takes longer for the new release to be available.

Get It Now!

So, if PowerShell Core isn’t available in the package repository, with a few steps you can download and install PowerShell. But, the first thing I do is to remove it before installing.

Ubuntu

## - When PowerShell Core isn't available in their repository: (download and execute install)
cd Downloads
wget https://github.com/PowerShell/PowerShell/releases/download/v6.1.1/powershell_6.1.1-1.ubuntu.18.04_amd64.deb
sudo dpkg -i powershell_6.1.1-1.ubuntu.18.04_amd64.deb

## - When available in Apt/Apt-Get repository:
sudo apt install -y powershell #-> Or, powershell-preview

CentOS

## - When PowerShell Core isn't available in their repository: (download and execute install)
## - Before removing PowerShell - use Invoke-WebRequest cmdlet.
pwsh
invoke-webrequest https://github.com/PowerShell/PowerShell/releases/download/v6.1.1/powershell-6.1.1-1.rhel.7.x86_64.rpm
sudo yum install powershell-6.1.0-1.rhel.7.x86_64.rpm

## - When available in Yum repository:
sudo yum install powershell #-> or, powershell-preview

MacOS

## - When PowerShell Core isn't available in their repository: (download and execute install)
## - Before removing PowerShell - use Invoke-WebRequest cmdlet.
pwsh
invoke-webrequest https://github.com/PowerShell/PowerShell/releases/download/v6.1.1/powershell-6.1.1-osx-x64.pkg
sudo installer -pkg powershell-6.1.0-osx-x64.pkg -target /

## - When available in Home Brew repository:
brew cask install powershell #-> Or, powershell-preview

Make sure, when in doubt, to check the package management documentation for any of the non-Windows Systems.

Currently Available

As of now, at the time of writing this blog post, the following PowerShell Core versions are available:

  • PowerShell Core (GA) Version 6.1.1 – Release on 11/13/2018
  • PowerShell Core Preview Version 6.2.0-preview.2 – Release on 11/15/2018 (Updated)

More Information

Don’t forget to check the installation instruction for PowerShell Core installation in Github at this link.

Go ahead and give it a try!