How to Run PowerShell Script (.ps1) on Mac

In order to run PowerShell Script on Mac, you will first need to install PowerShell on your macOS.

One you PowerShell installed, you can run a .ps1 (PowerShell) script as follows.

pwsh path/of/script/powershell-script-name.ps1



Write-Host "Hello from PowerShell on Mac! (macOS)"
% pwsh ~/Desktop/hello.ps1

Hello from PowerShell on Mac! (macOS
Running PowerShell Script on Mac (macOS)

Facing issues? Have Questions? Post them here! I am happy to answer!

Author: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap