Recently Microsoft announced that PowerShell has been open sourced, and made generally available on Linux and Mac Os X. It is currently (04.11.2016) in alpha version available on github. I happen to have a Mac Book Pro available at home. And was pretty curious of what powershell mac os x would actually really be like. In this blog post I will walk you through the very beginning of using powershell Mac Os x. How does PowerShell Mac os X works? How to install powershell mac os x? what works currently on Powershell Mac Os x? What doesn’t work on Powershell Mac Os X? Where do we download powershell mac os x? etc… All of these first questions you have to start with powershell on Mac os x will be answered in this blog post.
PowerShell, became my bridge to discovering new platforms
I have to admit, that I am a SUPER Mac Noob. This means, that I have barely touched a Mac in my life. I have been a Windows Focused person for as long as I can remember. The good thing about PowerShell getting open sourced is that it draw a bridge for me to new platforms to work with, which I would normally never even think of touching.
I am not sure if any other ‘windows’ focused users like me have been tempting in seeing by how Powershell works on a Mac os x. Just in case, I detailed all the steps, since they were totally new for me.
The latest version is PowerShell 6.0 Alpha 13. I have updated all the links in the post to the latest version. See below for the download link, and read at the bottom of this article what the latest version brought to the game.
->22/11/2016: Version 6.0 Alpha 13 is released.
->02/11/2016: Version 6.0 Alpha 12 is released.
-> 18/10/2016: An update to the PowerShell Core package came out (18/10/2016).
How to install powershell on mac os x?
Since I update this post at each new release, the Screenshots in this article might indicate old version numbers, but the operations to install etc…are still valid. All links are updated to always point to the latest powershell for OS x version. (If you find a missing link, please let me know in the comment section).
First things first, you will need to download the pkg file on the official powershell github page here.
Once downloaded, we can either open a terminal, and launch the installation of powershell mac os x as followed:
sudo installer -pkg powershell-6.0.0-alpha.13.pkg -target /
as explained in the install instructions here.
Or you can simply double click the powershell mac os x .pkg like I did. Of course, having my beginner noob karma, I have bounced in the following errer message:
powershell-6-0-0-alpha.12.pkg can’t be opened because it from an unidentified developer.
After some researches (and quite a few failed attempts to try to do a right click…) I found where I could fix this. You will have to go to “system” – “Security & Privacy” and then click on “Click on the lock to unlock” (it took me a short while to actually realize that that image was ‘clickable’).
Another way of doing it is pointed out by “Joe” in the comments:
‘Instead of disabling the system security, you can Ctrl+Click the .PKG and click Open to bypass the unknown developer lockout. This works with .APPs by the way and only needs to be done once.’
What is cool about this, is that OS X will remember this, and make it a standard behaviour for any double click in the futur.
Thanks again to Joe for this feedback!
The installation will then start, and will be pretty similar to a windows installation process.
You will need to provide credentials that has administrative priviledges to install powershell mac os x.
And after a short while, it will be installed.
Now that powershell was installed, you can directly open a terminal and write “powershell” to launch the powershell process in Terminal. The first thing to check is the $psversiontable to see on which version we are currently working on.
I was also very curious about the amount of cmdlets that have been made available in powershell mac os x. we can see that a total of 345 cmdlets have been shipped in the alpha version (22.214.171.124) In the second part of the screen shot below.
Detailed information on which cmdlets have been shipped, which cmdlets are currently working, which ones have been reported as having issues can be found here.
The next step what to see the amount of modules. I was surprised that only 4 were available on my system as showed in the screenshot below.