powershell mac osx

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:

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.

powershell mac os x installation

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’).

powershell mac os x installation

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.

powershell mac os x installation

powershell mac os x installation

You will need to provide credentials that has administrative priviledges to install powershell mac os x.

powershell mac os x installation

And after a short while, it will be installed.

powershell mac os x installation

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 ( In the second part of the screen shot below.

powershell mac os x powershell version

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.

powershell mac os x powershell modules

Accessing Mac OS X system information using PowerShell

The next step was I wanted to know what version of Mac Os X I was running on, and was trying to find an equivalent to the win32_operatingsystem CIM class (or something that could provide me the same information) of my system. I quickly found about “system_profiler” on mac os x, and soon after that wrote the following powershell function that will return mac os x system information from within a powershell console.

OsxSystem infos

Powershell core comes with the following four automatic variables:

  • $IsCoreCLR
  • $IsLinux
  • $IsOsX
  • $IsWindows

powershell mac os x powershell core automatic variables

Their purpose is pretty self explanatory. These automatic variables will definitely be very useful in the future to identify on which type of system we are executing the powershell.

Powershell mac os x: working with the file system

The last test I did was to use some existing powershell knowledge, and to see how that would work in a powershell terminal on mac os x. I have created all these screen shots on the desktop of my Mac Os x, I needed to move them in a subfolder to keep my desktop clean and tidy: Sounds like the perfect real first powershell task on my mac os x.

I noticed ‘very’ quickly a little anoying thing that I totaly forgot that existed: Case sensitivty (except for when I work with JavaScript….).

PowerShell is normally on windows systemsnot case sensitive. But in PowerShell core – On mac os x and linux – powershell os x is case sensitive.

powershell mac os x powershell case sensitive

I simply copied over the pictures from my desktop to the pictures folder.

powershell mac osx Simple file copy

Latest improvements in PowerShell core

As explained previously, PowerShell core is the version of powershell that is opened sourced and made available for mac os x. Find here under the improvements added to the latest versions.

6.0 Alpha.12:

  • Fix Get-ChildItem -Recurse -ErrorAction Ignore to ignore additional errors
  • Don’t block pipeline when running Windows exes
  • Fix for PowerShell SSH remoting with recent Win32-OpenSSH change.
  • Select-Object with -ExcludeProperty now implies -Property * if -Property is not specified.
  • Adding ValidateNotNullOrEmpty to -Name parameter of Get-Alias
  • Enable Implicit remoting commands in PowerShell Core
  • Fix GetParentProcess() to replace an expensive WMI query with Win32 API calls
  • Fix Set-Content failure to create a file in PSDrive under certain conditions.
  • Adding ValidateNotNullOrEmpty to -Name parameter of Get-Service
  • Adding support in Get-WinEvent -FilterHashtable
  • Adding WindowsVersion to Get-ComputerInfo
  • Remove the unnecessary use of lock in PseudoParameterBinder to avoid deadlock
  • Refactor Get-WinEvent to use StringBuilder for XPath query construction
  • Clean up and fix error handling of libpsl-native
  • Exclude Registry and Certificate providers from UNIX PS
  • Update PowerShell Core to consume DotNet Core preview1-24530-04

6.0 Alpha.11:

  • Add ‘-Title’ to ‘Get-Credential’ and unify the prompt experience
  • Update dependency list for PowerShell Core on Linux and OS X
  • Fix ‘powershell -Command -‘ to not hang and to not ignore the last command
  • Fix binary operator tab completion
  • Enable ‘ConvertTo-Html’ in PowerShell Core
  • Remove most Maximum* capacity variables
  • Fix ‘Get-ChildItem -Hidden’ to work on system hidden files on Windows
  • Fix ‘JsonConfigFileAccessor’ to handle corrupted ‘PowerShellProperties.json’ and defer creating the user setting directory until a write request comes
  • Fix variable assignment to not overwrite readonly variables
  • Fix ‘Get-WinEvent -FilterHashtable’ to work with named fields in UserData of event logs
  • Fix ‘Get-Help -Online’ in PowerShell Core on Windows
  • Spelling/grammar fixes

6.0 Alpha.10

  • Fix passing escaped double quoted spaces to native executables
  • Add Dockerfiles to build each Linux distribution
  • ~/.config/PowerShell capitalization bug fixed
  • Fix crash on Windows 7
  • Fix remote debugging on Windows client
  • Fix multi-line input with redirected stdin
  • Add PowerShell to /etc/shells on installation
  • Fix Install-Module version comparison bug
  • Spelling fixes

All releases can be found here.

By | 2016-12-02T17:00:04+00:00 September 1st, 2016|mac os x, powershell core|14 Comments

About the Author:

Stéphane is a dynamic and passionate Cloud and datacenter Microsoft MVP since. He is the founder of the Basel PowerShell user Group (BPUG), the co-founder of the French Speaking PowerShell UserGroup (FRPSUG), author, blogger, and received the community award "PowerShell Hero" from PowerShell.org. Stéphane has implemented microsoft infrastructure solutions in various countries of Europe and is currently working in Basel / Switzerland. Stéphane help his clients to reduce their global infrastructure costs by implementing Microsft infrastructure solutions by combining great products such as System Center, Windows Server, with heavy automation using Windows PowerShell. Stéphane loves languages, Belgium beer, French cheese and French Wine. If any of these topics are of your interest, don't hesitate to come and say hi.


  1. Micha December 22, 2016 at 7:33 am - Reply

    Hi! Thanks for the write up. You can change the default directory for screenshot with this command in the terminal
    defaults write com.apple.screencapture location ~/Documents/Screenshots

    • Stephane December 22, 2016 at 1:49 pm - Reply

      Thanks Micha for the feedback. I’ll add that as soon as I will get access to ‘my’ Mac again ^^

  2. Aubrey November 17, 2016 at 5:27 am - Reply

    Anyone know how to install modules in Powershell for Mac OS? I was looking to get poweralto.psm1 added.

    • Zack Knight (@Zjknight) January 8, 2017 at 2:39 am - Reply

      I had to give myself permission to the Modules folder to copy my module there. I think it’s a result of running VSCode (where I am running PowerShell) and not having the same ‘Run As Admin’ capability as Windows. I got the module folder path in powershell with $pshome/Modules. Then in terminal: sudo chown
      Seems like they’d set that permission in the installer. I’m not much of a Mac user though.

  3. The Ocean Midge November 1, 2016 at 4:43 am - Reply

    Anyone else finding powershell is glacially slow on Mac OS?
    If I chuck this at it:
    for($i=1; $i -le 10; $i++){Write-Host $i}
    it returns about 1 digit every 10 seconds. If that.
    I’m just launching it from terminal, typing “powershell”

    • Billy the Kid November 4, 2016 at 5:37 am - Reply

      I get the same result…ugh

    • rhywun January 6, 2017 at 4:29 am - Reply

      I get immediate results – just installed alpha14 FWIW

  4. Aminata Kondeh September 8, 2016 at 4:32 pm - Reply

    This is awesome Stephane! Thank you very much

  5. Joe September 8, 2016 at 5:31 am - Reply

    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. OS X remembers the overrides on next standard double click.

    • Stephane September 8, 2016 at 6:30 am - Reply

      Hi Joe,

      Thanks for comment! Like I said, I am really a Mac noob, and keep learning everyday ;). I have updated the post with your suggestion.
      Thanks again for your feedback!


  6. Dave September 6, 2016 at 4:39 pm - Reply

    Any suggestions for accessing Office 365 from powershell on a Mac?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: