Installing PowerShell on Mac OS X is a relatively simple process that can be done in a few easy steps.
Please note: these instructions are for Mac OS X version after 10.13 and above, as PowerShell only supports 64-bit versions. If you are running on earlier version of mac, you need to install package management system like Homebrew and then install PowerShell via brew, as documented by Microsoft.
1) First, download the PowerShell package for Mac OS X from the official Microsoft website. This package can be found at https://github.com/PowerShell/PowerShell/releases. Make sure to download the package that is appropriate for your version of Mac OS X.
2) Once the package has been downloaded, open the Terminal application on your Mac. This can be found in the Applications > Utilities folder (not to be confused with the launchpad).
3) In the Terminal, navigate to the directory where the PowerShell package was downloaded. For example, if the package was downloaded to the “Downloads” folder, the command would be:
4) Next, use the “sudo” command to install the package. This will require you to enter your administrator password. The command to install the package is below, but make sure the filename matches the version that you downloaded.
sudo installer -pkg powershell-7.3.1-osx-arm64.pkg -target /
You’ll then see a prompt asking to all Terminal access to the folder, click ‘OK’.
5) After the installation is complete, you see this message:
6) Test PowerShell by running it with the below command:
If you see the same response as below, you’re all good.
You can always test it further by running a PowerShell command, such as:
That’s it! You now have PowerShell installed on your Mac and can begin using it for your scripting and automation needs. Keep in mind, however, that PowerShell for Mac is not exactly the same as the Windows version, with some features and modules excluded, but it still has its place and is useful to have.