NOTE: Original instructions are here, I have just duplicated here for easy access.
Do the following from the macOS console:
Install Homebrew. If you dont already have it, run this:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install Homebrew-Cask so future installations of software via brew is much nicer.
brew tap caskroom/cask
Now you can install PowerShell by running:
brew cask install powershell
You can be sure it is working by running:
This should give you the powershell prompt and away you go!
Run the following from the console:
brew updatebrew cask upgrade powershell
That should do it.
If for whatever reason you want to reinstall PowerShell use:
brew cask reinstall powershell
If you are nuts and want to remove PowerShell from macOS run:
brew cask uninstall powershell