Installing PowerShell Core on macOS and Linux

Supports Ubuntu 14.04, Ubuntu 16.04, Ubuntu 17.04, Debian 8, Debian 9, CentOS 7, Red Hat Enterprise Linux (RHEL) 7, OpenSUSE 42.2, Fedora 25, Fedora 26, Arch Linux, and macOS 10.12.

For Linux distributions that are not officially supported, you can try using the PowerShell AppImage. You can also try deploying PowerShell binaries directly using the Linux tar.gz archive, but you would need to set up the necessary dependencies based on the OS in separate steps.

All packages are available on our GitHub releases page. Once the package is installed, run pwsh from a terminal.

Ubuntu 14.04

Installation via Package Repository - Ubuntu 14.04

PowerShell Core, for Linux, is published to package repositories for easy installation (and updates). This is the preferred method.

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Ubuntu repository
curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, from then on, you just need to use sudo apt-get upgrade powershell to update it.

Installation via Direct Download - Ubuntu 14.04

Download the Debian package powershell_6.0.0-rc-1.ubuntu.14.04_amd64.deb from the releases page onto the Ubuntu machine.

Then execute the following in the terminal:

sudo dpkg -i powershell_6.0.0-rc-1.ubuntu.14.04_amd64.deb
sudo apt-get install -f

Please note that dpkg -i will fail with unmet dependencies; the next command, apt-get install -f resolves these and then finishes configuring the PowerShell package.

Uninstallation - Ubuntu 14.04

sudo apt-get remove powershell

Ubuntu 16.04

Installation via Package Repository - Ubuntu 16.04

PowerShell Core, for Linux, is published to package repositories for easy installation (and updates). This is the preferred method.

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Ubuntu repository
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, from then on, you just need to use sudo apt-get upgrade powershell to update it.

Installation via Direct Download - Ubuntu 16.04

Download the Debian package powershell_6.0.0-rc-1.ubuntu.16.04_amd64.deb from the releases page onto the Ubuntu machine.

Then execute the following in the terminal:

sudo dpkg -i powershell_6.0.0-rc-1.ubuntu.16.04_amd64.deb
sudo apt-get install -f

Please note that dpkg -i will fail with unmet dependencies; the next command, apt-get install -f resolves these and then finishes configuring the PowerShell package.

Uninstallation - Ubuntu 16.04

sudo apt-get remove powershell

Ubuntu 17.04

Installation via Package Repository - Ubuntu 17.04

PowerShell Core, for Linux, is published to package repositories for easy installation (and updates). This is the preferred method.

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Ubuntu repository
curl https://packages.microsoft.com/config/ubuntu/17.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, from then on, you just need to use sudo apt-get upgrade powershell to update it.

Installation via Direct Download - Ubuntu 17.04

Download the Debian package powershell_6.0.0-rc-1.ubuntu.17.04_amd64.deb from the releases page onto the Ubuntu machine.

Then execute the following in the terminal:

sudo dpkg -i powershell_6.0.0-rc-1.ubuntu.17.04_amd64.deb
sudo apt-get install -f

Please note that dpkg -i will fail with unmet dependencies; the next command, apt-get install -f resolves these and then finishes configuring the PowerShell package.

Uninstallation - Ubuntu 17.04

sudo apt-get remove powershell

Debian 8

Installation via Package Repository - Debian 8

PowerShell Core, for Linux, is published to package repositories for easy installation (and updates). This is the preferred method.

# Install system components
sudo apt-get update
sudo apt-get install curl apt-transport-https

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Product feed
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-jessie-prod jessie main" > /etc/apt/sources.list.d/microsoft.list'

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, from then on, you just need to use sudo apt-get upgrade powershell to update it.

Installation via Direct Download - Debian 8

Download the Debian package powershell_6.0.0-rc-1.debian.8_amd64.deb from the releases page onto the Debian machine.

Then execute the following in the terminal:

sudo dpkg -i powershell_6.0.0-rc-1.debian.8_amd64.deb
sudo apt-get install -f

Please note that dpkg -i will fail with unmet dependencies; the next command, apt-get install -f resolves these and then finishes configuring the PowerShell package.

Uninstallation - Debian 8

sudo apt-get remove powershell

Debian 9

Installation via Package Repository - Debian 9

PowerShell Core, for Linux, is published to package repositories for easy installation (and updates). This is the preferred method.

# Install system components
sudo apt-get update
sudo apt-get install curl gnupg apt-transport-https

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Product feed
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list'

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, from then on, you just need to use sudo apt-get upgrade powershell to update it.

Installation via Direct Download - Debian 9

Download the Debian package powershell_6.0.0-rc-1.debian.9_amd64.deb from the releases page onto the Debian machine.

Then execute the following in the terminal:

sudo dpkg -i powershell_6.0.0-rc-1.debian.9_amd64.deb
sudo apt-get install -f

Please note that dpkg -i will fail with unmet dependencies; the next command, apt-get install -f resolves these and then finishes configuring the PowerShell package.

Uninstallation - Debian 9

sudo apt-get remove powershell

CentOS 7

This package also works on Oracle Linux 7.

Installation via Package Repository (preferred) - CentOS 7

PowerShell Core for Linux is published to official Microsoft repositories for easy installation (and updates).

# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo

# Install PowerShell
sudo yum install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, you just need to use sudo yum update powershell to update PowerShell.

Installation via Direct Download - CentOS 7

Using CentOS 7, download the RPM package powershell-6.0.0_rc-1.rhel.7.x86_64.rpm from the releases page onto the CentOS machine.

Then execute the following in the terminal:

sudo yum install powershell-6.0.0_rc-1.rhel.7.x86_64.rpm

You can also install the RPM without the intermediate step of downloading it:

sudo yum install https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0_rc-1.rhel.7.x86_64.rpm

Uninstallation - CentOS 7

sudo yum remove powershell

Red Hat Enterprise Linux (RHEL) 7

Installation via Package Repository (preferred) - Red Hat Enterprise Linux (RHEL) 7

PowerShell Core for Linux is published to official Microsoft repositories for easy installation (and updates).

# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo

# Install PowerShell
sudo yum install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, you just need to use sudo yum update powershell to update PowerShell.

Installation via Direct Download - Red Hat Enterprise Linux (RHEL) 7

Download the RPM package powershell-6.0.0_rc-1.rhel.7.x86_64.rpm from the releases page onto the Red Hat Enterprise Linux machine.

Then execute the following in the terminal:

sudo yum install powershell-6.0.0_rc-1.rhel.7.x86_64.rpm

You can also install the RPM without the intermediate step of downloading it:

sudo yum install https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0_rc-1.rhel.7.x86_64.rpm

Uninstallation - Red Hat Enterprise Linux (RHEL) 7

sudo yum remove powershell

OpenSUSE 42.2

Note: When installing PowerShell Core, OpenSUSE may report that nothing provides libcurl. libcurl should already be installed on supported versions of OpenSUSE. Run zypper search libcurl to confirm. The error will present 2 'solutions'. Choose 'Solution 2' to continue installing PowerShell Core.

Installation via Package Repository (preferred) - OpenSUSE 42.2

PowerShell Core for Linux is published to official Microsoft repositories for easy installation (and updates).

# Register the Microsoft signature key
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

# Add the Microsoft Product feed
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/zypp/repos.d/microsoft.repo

# Update the list of products
sudo zypper update

# Install PowerShell
sudo zypper install powershell

# Start PowerShell
pwsh

Installation via Direct Download - OpenSUSE 42.2

Download the RPM package powershell-6.0.0_rc-1.rhel.7.x86_64.rpm from the releases page onto the OpenSUSE machine.

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo zypper install powershell-6.0.0_rc-1.rhel.7.x86_64.rpm

You can also install the RPM without the intermediate step of downloading it:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo zypper install https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0_rc-1.rhel.7.x86_64.rpm

Uninstallation - OpenSUSE 42.2

sudo zypper remove powershell

Fedora 25

Installation via Package Repository (preferred) - Fedora 25

PowerShell Core for Linux is published to official Microsoft repositories for easy installation (and updates).

# Register the Microsoft signature key
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo

# Update the list of products
sudo dnf update

# Install PowerShell
sudo dnf install -y powershell

# Start PowerShell
pwsh

Installation via Direct Download - Fedora 25

Download the RPM package powershell-6.0.0_rc-1.rhel.7.x86_64.rpm from the releases page onto the Fedora machine.

Then execute the following in the terminal:

sudo dnf install powershell-6.0.0_rc-1.rhel.7.x86_64.rpm

You can also install the RPM without the intermediate step of downloading it:

sudo dnf install https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0_rc-1.rhel.7.x86_64.rpm

Uninstallation - Fedora 25

sudo dnf remove powershell

Fedora 26

Installation via Package Repository (preferred) - Fedora 26

PowerShell Core for Linux is published to official Microsoft repositories for easy installation (and updates).

# Register the Microsoft signature key
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo

# Update the list of products
sudo dnf update

# Install a system component
sudo dnf install compat-openssl10

# Install PowerShell
sudo dnf install -y powershell

# Start PowerShell
pwsh

Installation via Direct Download - Fedora 26

Download the RPM package powershell-6.0.0_rc-1.rhel.7.x86_64.rpm from the releases page onto the Fedora machine.

Then execute the following in the terminal:

sudo dnf update
sudo dnf install compat-openssl10
sudo dnf install powershell-6.0.0_rc-1.rhel.7.x86_64.rpm

You can also install the RPM without the intermediate step of downloading it:

sudo dnf update
sudo dnf install compat-openssl10
sudo dnf install https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0_rc-1.rhel.7.x86_64.rpm

Uninstallation - Fedora 26

sudo dnf remove powershell

Arch Linux

PowerShell is available from the Arch Linux User Repository (AUR).

Packages in the AUR are community maintained - there is no official support.

For more information on installing packages from the AUR, see the Arch Linux wiki or the community DockerFile.

Linux AppImage

Using a recent Linux distribution, download the AppImage powershell-6.0.0-rc-x86_64.AppImage from the releases page onto the Linux machine.

Then execute the following in the terminal:

chmod a+x powershell-6.0.0-rc-x86_64.AppImage
./powershell-6.0.0-rc-x86_64.AppImage

The AppImage lets you run PowerShell without installing it. It is a portable application that bundles PowerShell and its dependencies (including .NET Core's system dependencies) into one cohesive package. This package works independently of the user's Linux distribution, and is a single binary.

macOS 10.12

Installation via Homebrew (preferred) - macOS 10.12

Homebrew is the missing package manager for macOS. If the brew command is not found, you need to install Homebrew following their instructions.

Once you've installed Homebrew, installing PowerShell is easy. First, install Homebrew-Cask, so you can install more packages:

brew tap caskroom/cask

Now, you can install PowerShell:

brew cask install powershell

When new versions of PowerShell are released, simply update Homebrew's formulae and upgrade PowerShell:

brew update
brew cask reinstall powershell

Note: because of this issue in Cask, you currently have to do a reinstall to upgrade.

Installation via Direct Download - macOS 10.12

Using macOS 10.12, download the PKG package powershell-6.0.0-rc-osx.10.12-x64.pkg from the releases page onto the macOS machine.

Either double-click the file and follow the prompts, or install it from the terminal:

sudo installer -pkg powershell-6.0.0-rc-osx.10.12-x64.pkg -target /

Uninstallation - macOS 10.12

If you installed PowerShell with Homebrew, uninstallation is easy:

brew cask uninstall powershell

If you installed PowerShell via direct download, PowerShell must be removed manually:

sudo rm -rf /usr/local/bin/pwsh /usr/local/microsoft/powershell

To uninstall the additional PowerShell paths (such as the user profile path) please see the paths section below in this document and remove the desired the paths with sudo rm. (Note: this is not necessary if you installed with Homebrew.)

Kali

Installation

# Install prerequisites
apt-get install libunwind8 libicu55
wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u6_amd64.deb
dpkg -i libssl1.0.0_1.0.1t-1+deb8u6_amd64.deb

# Install PowerShell
dpkg -i powershell_6.0.0-rc-1.ubuntu.16.04_amd64.deb

# Start PowerShell
pwsh

Run PowerShell in latest Kali (Kali GNU/Linux Rolling) without installing it

# Grab the latest App Image
wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0-rc-x86_64.AppImage

# Make executable
chmod a+x powershell-6.0.0-rc-x86_64.AppImage

# Start PowerShell
./powershell-6.0.0-rc-x86_64.AppImage

Uninstallation - Kali

dpkg -r powershell_6.0.0-rc-1.ubuntu.16.04_amd64.deb

Raspbian

Currently, PowerShell is only supported on Raspbian Stretch.

Installation

# Install prerequisites
sudo apt-get install libunwind8

# Grab the latest tar.gz
wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0-rc-linux-arm32.tar.gz

# Make folder to put powershell
mkdir ~/powershell

# Unpack the tar.gz file
tar -xvf ./powershell-6.0.0-rc-linux-arm32.tar.gz -C ~/powershell

# Start PowerShell
~/powershell/pwsh

Uninstallation - Raspbian

rm -rf ~/powershell

Binary Archives

PowerShell binary tar.gz archives are provided for macOS and Linux platforms to enable advanced deployment scenarios.

Dependencies

For Linux, PowerShell builds portable binaries for all Linux distributions. But .NET Core runtime requires different dependencies on different distributions, and hence PowerShell does the same.

The following chart shows the .NET Core 2.0 dependencies on different Linux distributions that are officially supported.

OS Dependencies
Ubuntu 14.04 libc6, libgcc1, libgssapi-krb5-2, liblttng-ust0, libstdc++6,
libcurl3, libunwind8, libuuid1, zlib1g, libssl1.0.0, libicu52
Ubuntu 16.04 libc6, libgcc1, libgssapi-krb5-2, liblttng-ust0, libstdc++6,
libcurl3, libunwind8, libuuid1, zlib1g, libssl1.0.0, libicu55
Ubuntu 17.04 libc6, libgcc1, libgssapi-krb5-2, liblttng-ust0, libstdc++6,
libcurl3, libunwind8, libuuid1, zlib1g, libssl1.0.0, libicu57
Debian 8 (Jessie) libc6, libgcc1, libgssapi-krb5-2, liblttng-ust0, libstdc++6,
libcurl3, libunwind8, libuuid1, zlib1g, libssl1.0.0, libicu52
Debian 9 (Stretch) libc6, libgcc1, libgssapi-krb5-2, liblttng-ust0, libstdc++6,
libcurl3, libunwind8, libuuid1, zlib1g, libssl1.0.2, libicu57
CentOS 7
Oracle Linux 7
RHEL 7
OpenSUSE 42.2
Fedora 25
libunwind, libcurl, openssl-libs, libicu
Fedora 26 libunwind, libcurl, openssl-libs, libicu, compat-openssl10

In order to deploy PowerShell binaries on Linux distributions that are not officially supported, you would need to install the necessary dependencies for the target OS in separate steps. For example, our Amazon Linux dockerfile installs dependencies first, and then extracts the Linux tar.gz archive.

Installation - Binary Archives

Linux

# Download the powershell '.tar.gz' archive
curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0-rc-linux-x64.tar.gz

# Create the target folder where powershell will be placed
sudo mkdir -p /opt/microsoft/powershell/6.0.0-rc

# Expand powershell to the target folder
sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/6.0.0-rc

# Set execute permissions
sudo chmod +x /usr/local/microsoft/powershell/6.0.0-rc/pwsh

# Create the symbolic link that points to pwsh
sudo ln -s /opt/microsoft/powershell/6.0.0-rc/pwsh /usr/bin/pwsh

macOS

# Download the powershell '.tar.gz' archive
curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0-rc-osx-x64.tar.gz

# Create the target folder where powershell will be placed
sudo mkdir -p /usr/local/microsoft/powershell/6.0.0-rc

# Expand powershell to the target folder
sudo tar zxf /tmp/powershell.tar.gz -C /usr/local/microsoft/powershell/6.0.0-rc

# Set execute permissions
sudo chmod +x /usr/local/microsoft/powershell/6.0.0-rc/pwsh

# Create the symbolic link that points to pwsh
sudo ln -s /usr/local/microsoft/powershell/6.0.0-rc/pwsh /usr/local/bin/pwsh

Uninstallation - Binary Archives

Linux

sudo rm -rf /usr/bin/pwsh /opt/microsoft/powershell

macOS

sudo rm -rf /usr/local/bin/pwsh /usr/local/microsoft/powershell

Paths

  • $PSHOME is /opt/microsoft/powershell/6.0.0-rc/
  • User profiles will be read from ~/.config/powershell/profile.ps1
  • Default profiles will be read from $PSHOME/profile.ps1
  • User modules will be read from ~/.local/share/powershell/Modules
  • Shared modules will be read from /usr/local/share/powershell/Modules
  • Default modules will be read from $PSHOME/Modules
  • PSReadline history will be recorded to ~/.local/share/powershell/PSReadLine/ConsoleHost_history.txt

The profiles respect PowerShell's per-host configuration, so the default host-specific profiles exists at Microsoft.PowerShell_profile.ps1 in the same locations.

On Linux and macOS, the XDG Base Directory Specification is respected.

Note that because macOS is a derivation of BSD, instead of /opt, the prefix used is /usr/local. Thus, $PSHOME is /usr/local/microsoft/powershell/6.0.0-rc/, and the symlink is placed at /usr/local/bin/pwsh.