PowerShell is now open source, and available for Linux and Mac. You can download official packages from Microsoft for the 64-bit versions of Ubuntu 16.04, Ubuntu 14.04, CentOS 7, Red Hat Enterprise Linux 7, and Mac OS X 10.11.
Download the Packages from Microsoft
Visit the PowerShell project’s Releases page on GitHub to find the packages. Download the appropriate one for your operating system:
- 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”.
How to Install PowerShell on Linux
With the package downloaded, launch a terminal window on your Linux desktop. You’ll now need to install the package’s dependencies and the package itself.
On Ubuntu 16.04, run the following commands:
sudo apt-get install libunwind8 libicu55 sudo dpkg -i /path/to/powershell.deb
So, if you downloaded the package “powershell_6.0.0-alpha.9-1ubuntu1.16.04.1_amd64.deb” to the Downloads folder in your home folder, you’d run the following commands:
sudo apt-get install libunwind8 libicu55 sudo dpkg -i ~/Downloads/powershell_6.0.0-alpha.9-1ubuntu1.16.04.1_amd64.deb
Note that you can use tab completion to speed up this process. For example, if the file was in your Downloads folder, you’d type ~/Downloads/powershell and then press Tab. Bash will automatically complete the file name if it’s the only file that starts with “powershell” in that directory.
On Ubuntu 14.04, run the following commands:
sudo apt-get install libunwind8 libicu52 sudo dpkg -i /path/to/powershell.deb
On CentOS 7, run the following commands:
sudo yum install /path/to/powershell.rpm
If all goes well, PowerShell should now be installed on your system.
How to Install PowerShell on a Mac
To install PowerShell on a Mac, just double-click the downloaded .pkg file. It will launch a package installer and install PowerShell like any other application.
At the moment, the package doesn’t appear to be signed, so you’ll have to bypass Gatekeeper to install it. To do so, right-click or Ctrl-click the file .pkg, select “Open”, and agree to run the installer.
How to Launch PowerShell on Linux or Mac
Open a terminal and run the “powershell” command to access a PowerShell shell environment. This works on both Linux and Mac–whichever you’re using.
You’ll see a PowerShell prompt beginning with “PS”, and you can run PowerShell cmdlets just as you would on Windows.
To leave the PowerShell prompt, just type “exit” and press Enter or close the terminal window.
For more detailed information, visit the PowerShell project’s GitHub page. You can download the source code, report issues, and view more official documentation there.