Can I install and Use PowerShell on my macOS?. PowerShell is a cross-platform task automation and configuration management framework, consisting of a command-line shell and scripting language. Unlike most shells, which accept and return text, PowerShell is built on top of the . NET Common Language Runtime (CLR), and accepts and returns.

For the installation of PowerShell 7.0 or higher, macOS 10.13 and higher is required. PowerShell packages for macOS, Windows and Linux packages are available on the GitHub releases page. There are several ways you can reference to install PowerShell on macOS.

We’ll be using the Homebrew installation method. Homebrew is the preferred package manager for macOS and can easily be installed using the following command in your terminal.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

When Homebrew has been installed you can then use the brew command to install PowerShell on macOS.

brew install --cask powershell

The installation should not take long to completetion.

==> Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.1.0/powershell-7.1.0-osx-x64.pkg
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/49609581/53dced00-2377-11eb-9e04-9458ce3dd8ce?X-Amz-Algorithm=AWS4-HMAC-SHA25
######################################################################## 100.0%
==> Installing Cask powershell
==> Running installer for powershell; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
installer: Package name is PowerShell - 7.1.0
installer: Installing at base path /
installer: The install was successful.
🍺  powershell was successfully installed!

You can perform updates at any point in time by using these commands:

brew update
brew upgrade powershell --cask

Verify the installation was successful by running the command below.

$ pwsh
PowerShell 7.1.0
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /Users/jkmutai>

Output version details:

PS /Users/jkmutai> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.0
PSEdition                      Core
GitCommitId                    7.1.0
OS                             Darwin 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:11 PDT 2020; root:xnu-7195.50.7~2/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Important installation Paths:

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

How To Uninstall PowerShell on macOS

If you installed PowerShell with Homebrew, use the following command to uninstall:

brew cask uninstall powershell

For the actual PowerShell usage guides the official documentation should be your next place.

Related articles:

 Install and Use Nu Shell on Linux

Install and Configure eDEX-UI terminal emulator on Linux

Install Alacritty Terminal Emulator on Linux, macOS and Windows

LEAVE A REPLY

Please enter your comment!
Please enter your name here