How to run Powershell script on mac?
We need to install the stable version of power shell on mac using the below steps and run the script in terminal
Installation of latest stable release via Homebrew on macOS 10.13 or higher
There are several ways to install PowerShell on macOS. Choose one of the following methods:
- Install using Homebrew. Homebrew is the preferred package manager for macOS.
- Install PowerShell via Direct Download
- Install from binary archives.
After installing PowerShell, you should install OpenSSL. OpenSSL is needed for PowerShell WSMan remoting.
If the brew command is not found, you need to install Homebrew following their instructions.
Bash/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Now, you can install PowerShell:
sh brew install --cask powershell
Finally, verify that your install is working properly:
sh pwsh
To run the powershell script
1) Open Terminal in the mac
2) Type pwsh command and powershell terminal will be opened as shown below
3) Navigate to the script path and execute the script using ./powershellscript.sh
Comments
Post a Comment