How to Install Microsoft PowerShell on OS X?

PowerShell is a task automation and configuration management framework from Microsoft. PowerShell has now become open source. Thus, PowerShell is now available for other operating systems such as OS X and Linux. The software is available as Microsoft packages 64-bit versions of Ubuntu 16.04, Ubuntu 14.04, CentOS 7, Red Hat Enterprise Linux 7, and Mac OS X 10.11.

PowerShell Release Page on GitHub contains all the packages. Here are the ones you might need.

  • Ubuntu 16.04: Download the package ending in “16.04.1_amd64.deb”.
  • Ubuntu 14.04: Download the package ending in “14.04.1_amd64.deb”.
  • CentOS 7 and Red Hat Enterprise Linux 7: Download the package ending in “el7.centos.x86_64.rpm”.
  • Mac: Download the package ending in “.pkg”.

Steps to Install PowerShell on a Mac OS

  1. First of all, download the .pkg file from the PowerShell release page in GitHub.
  2. Next, double tap on the downloaded .pkg file.
  3. The package installer will be launched. Then install PowerShell just like a normal application.
  4. Since the application is not signed, you will have to bypass the gatekeeper in order to install it.
  5. Right-click on the file .pkg, select “Open”. Next, agree to run the installer.
  6. You are done. Now open Terminal. Type powershell and hit Enter to run the command. You can now access the PowerShell shell environment. That’s all!

 

 

Source