Run PowerShell on Mac OS X

As you have probably heard by now, Microsoft has just open-sourced PowerShell and made it available for Linux and Mac OS X. In this blog post, I will take you through the steps to download, install and run PowerShell on a Mac.

Download and Install PowerShell for Mac OX

  1. Go to PowerShell github project: https://github.com/PowerShell/PowerShell
  2. Scroll down to the Get PowerShell section and download .pkg:

Download OS X pkg file for PowerShell

3. Locate the newly downloaded file in Downloads, right-click it and click Open:

Install PowerShell pkg on Mac OS X

4. You will be warned that this is a file from the Internet and then prompted for your local administrative password, then go through the installation wizard.

Run PowerShell on Mac OS X

PowerShell is a command-prompt in your terminal window, so to start it:

  1. Start the Terminal application,
  2. Now you can simply type powershell as a command and this will start the PowerShell engine and move you from the bash prompt ($) to the PowerShell prompt (PS):
    Starting PowerShell prompt on Mac OS X in bash Terminal

  3. That is it! You can now type a PowerShell command and see the output. For example, here’s Get-Process:
    Get-Process powershell command on Mac OS X

If you are new to PowerShell, see the Learning PowerShell page on GitHub.

8 Responses to “Run PowerShell on Mac OS X”


  1. 1 Patrick Minze August 19, 2016 at 6:29 pm

    Can you install the AzureRM cmdlets?

  2. 2 Patrick Minze August 19, 2016 at 6:31 pm

    Can you install AzureRM cmdlets, or is just the standard out of the box Powershell?

    • 3 Dmitry Sotnikov August 20, 2016 at 6:32 am

      Well, on the first attempt it didn’t work for me:

      PS /usr> Install-Module AzureRM                                                 
      PackageManagement\Install-Package : Unable to find module providers 
      (PowerShellGet).
      At /usr/local/microsoft/powershell/6.0.0-alpha.9/Modules/PowerShellGet/PSModule
      .psm1:1706 char:21
      + ...          $null = PackageManagement\Install-Package @PSBoundParameters
      +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (Microsoft.Power....InstallPack 
         age:InstallPackage) [Install-Package], Exception
          + FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageMan 
         agement.Cmdlets.InstallPackage
      
  3. 6 Anonymous April 29, 2017 at 11:16 pm

    Sudo Powershell then run Install-Module AzureRM

  4. 7 js2010 June 3, 2017 at 3:30 pm

    That bright yellow for commands is horrible, as is white or gray for other things. My $profile starts like this:

    set-psreadlineoption command darkyellow
    set-psreadlineoption number darkgray
    set-psreadlineoption member darkgray
    set-psreadlineoption operator darkgray
    set-psreadlineoption type darkgray

  5. 8 Sathish Narayanan May 24, 2018 at 11:21 pm

    In MacOs shell command of PowerShell changed pwsh.


Leave a comment




Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

August 2016
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031