Installing PowerShell Core on macOS

PowerShell Core supports macOS 10.12 and higher. All packages are available on our GitHub releases page. Once the package is installed, run pwsh from a terminal.

Installation of latest stable release via Homebrew on macOS 10.12 or higher

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

Now, you can install PowerShell:

brew cask install powershell

Finally, verify that your install is working properly:

pwsh

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

brew update
brew cask upgrade powershell

Note

The commands above can be called from within a PowerShell (pwsh) host, but then the PowerShell shell must be exited and restarted to complete the upgrade. and refresh the values shown in $PSVersionTable.

Installation of latest preview release via Homebrew on macOS 10.12 or higher

Homebrew is the preferred 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 Cask-Versions which lets you install alternative versions of cask packages:

brew tap homebrew/cask-versions

Now, you can install PowerShell:

brew cask install powershell-preview

Finally, verify that your install is working properly:

pwsh-preview

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

brew update
brew cask upgrade powershell-preview

Note

The commands above can be called from within a PowerShell (pwsh) host, but then the PowerShell shell must be exited and restarted to complete the upgrade. and refresh the values shown in $PSVersionTable.

Installation via Direct Download

Download the PKG package powershell-6.1.0-osx-x64.pkg from the releases page onto your macOS machine.

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

sudo installer -pkg powershell-6.1.0-osx-x64.pkg -target /

Binary Archives

PowerShell binary tar.gz archives are provided for the macOS platform to enable advanced deployment scenarios.

Installing binary archives on macOS

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

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

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

# Set execute permissions
sudo chmod +x /usr/local/microsoft/powershell/6.1.0/pwsh

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

Uninstalling PowerShell Core

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 remove the additional PowerShell paths, please see the paths section in this document and remove the desired the paths using sudo rm.

Note

This is not necessary if you installed with Homebrew.

Paths

  • $PSHOME is /usr/local/microsoft/powershell/6.1.0/
  • 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.

PowerShell respects the XDG Base Directory Specification on macOS.

Because macOS is a derivation of BSD, the prefix /usr/local is used instead of /opt. Thus, $PSHOME is /usr/local/microsoft/powershell/6.1.0/, and the symlink is placed at /usr/local/bin/pwsh.

Additional Resources