I’m sure you’ve seen it, PowerShell has been open sourced and is now available on OS X and Linux. Good news is, you can also run PowerShell on macOS Sierra beta in everything I’ve tested so far (I spent more of the day the other day just writing and running Powershell within macOS beta).

Enough about the release, you can go read all about it here – https://azure.microsoft.com/en-us/blog/powershell-is-open-sourced-and-is-available-on-linux/

Install Process

If you’re on OS X or macOS, here is how you get it running:

  1. Browse to – https://github.com/PowerShell/PowerShell
  2. Scroll down the page a little bit and you’ll find the links to both the .pkg download as well as instructions
    PoSH Download for Mac
  3. Once the .pkg file is downloaded, you can either install it via the command line using:
    sudo installer -pkg powershell-6.0.0-alpha.9.pkg -target /
    or by opening the .pkg.
    If you install by open the .pkg, you’ll need to right click on the file and select open (rather than just double clicking) due to it not being signed and coming from and “unverified developer”.
  4. Walk through the install process shown in the following screenshots, there is nothing unique about the install, just a typical macOS application install.

Here is a quick video showing the install process using the terminal, running some PowerShell and then modifying Visual Studio Code to make PowerShell my default environment.

Now that it’s installed, we’ll walk through running PowerShell and writing some scripts

Running PowerShell

  1. Launch your Terminal, this could be the native Terminal, iTerm, etc.
  2. Type “PowerShell” and hit Enter, you’ll see PowerShell load and your terminal lines will be prefixed with PS
  3. That’s it, start running PowerShell cmdlets such as Get-ChildItem

Set PowerShell as the default in Visual Studio Code

If you want to set PowerShell as the default shell in your integrated shell in Visual Studio, just walk through these steps as shown in the video above:

  1. Code (in the Menu bar) -> Preferences -> User Settings
  2. Add the line: "terminal.integrated.shell.osx": "/usr/local/bin/powershell"
  3. Save the File and Reopen Visual Studio Code. Now when you open the integrated terminal it will be running PowerShell.