PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. PowerShell runs on Windows, Linux, and macOS. PowerShell is supported on macOS 10.12 and higher. All packages are available on the GitHub releases page. To install PowerShell on macOS, the Homebrew package manager is utilized. To have the Homebrew package manager installed on your device, visit the following link. Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple’s operating system macOS as well as Linux. The name is intended to suggest the idea of building software on the Mac. See this guide on how to upgrade PowerShell to the latest version on macOS.
Homebrew is package manager for Macs which makes installing lots of different software like Git, Ruby, and Node simpler. Homebrew lets you avoid possible security problems associated with using the sudo command to install software like Node. The steps below are ways to install PowerShell on macOS.
Via Homebrew: Launch your iTerm (Terminal emulator for macOS)
– Run the below commands to install Powershell
brew cask install powershell
After the package is installed, run “pwsh” from a terminal.
Now, you can continue running some Command Prompt commands and PowerShell cmdlets as well on your macOS. See some examples below.
Now you can run PowerShell cmdlets right inside your macOS device 🙂
To uninstall PowerShell from your device, run the following command below
brew cask uninstall powershell
Note: This is only applicable if you used the homebrew package manager to install PowerShell, otherwise you will have to uninstall PowerShell manually
I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.