As an owner of numerous Apple products (and a perpetual PowerShell fanboy), I quickly jumped on the bandwagon and installed PowerShell on my Macbook Pro. This post walks through installing PowerShell on OSX and configuring the OSX terminal to provide a familiar PowerShell user experience.PowerShell is now available on macOS & Linux and is open sourced!— jsnover (@jsnover) August 18, 2016
My blog: https://t.co/xN6GCCnE9G
Mic drop!
First things first, let us take a journey to the PowerShell project on github.
From this page, you can view the source code, check out issues, and check out releases. You have the option of downloading the source and compiling it, but the PowerShell team has already done this for you. By visiting the "Releases" page, you will be presented with a list of PowerShell releases. To download the latest and greatest version, look for the the "Latest release" tag which as of this posting is v6.0.0-alpha.9.
Once you identify your desired release, scroll down to the release's download section and click on the .pkg (or Apple Software Package).
From there, it installs like any other internet application.
NOTE: If your security settings do not allow installation of applications from "non-identified developers", you will have to allow the installation of PowerShell via the Security & Privacy settings menu.
Congratulations! You have installed PowerShell on your Mac! You can now open up the Terminal App, execute /usr/local/bin/powershell (or type powershell) and start running PowerShell commands just like on Windows. After a couple hours of using PowerShell in the OSX Terminal, I found the Terminal settings to not be ideal for PowerShell (particularly the syntax highlighting). I decided to create a custom PowerShell profile to create the same familiar experience that I am used to on Windows. To do this open the Terminal preferences menu by selecting Terminal > Preferences.
We want to create a custom Terminal profile for PowerShell. In the Preferences menu, select "Profiles" and click on the symbol in the bottom right corner. First things first, lets set our background and text colors. I chose White, Magnesium, and Cantaloupe for my Text, Bold Text, and Selection colors respectively (trying to mirror powershell.exe as much as possible).
For the Background color I selected a custom color based on Windows powershell.exe blue. You can set the color by choosing the RGB Sliders option with Hex 0x001845.
Next, I want to set this profile to automatically run PowerShell upon the Terminal starting. To do this visit the profile's "Shell" tab and enter a "Run command" of /usr/local/bin/powershell.
The last optional step is to set the PowerShell as the default Terminal profile, assuming you always want to use PowerShell like I do. This will cause the Terminal app to always start with the PowerShell profile set.
Open a new Terminal window, and you will hopefully have a fairly familiar experience!