How to Install and Use PowerShell on macOS (2025 Edition)
PowerShell began life as a Windows‑only shell, but today it runs smoothly on macOS and Linux as well. With its object‑oriented pipeline and rich scripting language, PowerShell lets developers, DevOps engineers, and system administrators automate tasks across mixed operating‑system environments while using the same commands everywhere.
Installing PowerShell with Homebrew
First, make sure Homebrew—the de‑facto package manager for macOS—is available. If it isn’t, open Terminal and paste:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After Homebrew finishes, refresh its package index:
brew update
Now install PowerShell itself:
brew install --cask powershell
When the installer completes, launch the shell by typing:
pwsh
The prompt switches from bash or zsh to PS, signaling you’re inside PowerShell.
Getting Comfortable in PowerShell
To view the contents of the current folder, use:
Get-ChildItem
Need basic system information?
Get-ComputerInfo
Creating a new directory is equally straightforward:
New-Item -ItemType Directory -Path "./MyFolder"
PowerShell commands—or cmdlets—return structured objects rather than plain text. That design choice lets you pipe data into the next cmdlet and filter or sort by properties without string‑parsing gymnastics.
For built‑in documentation, rely on Get-Help:
Get-Help Get-Process
If the first run says help files are missing, accept the prompt to download them; afterward, you’ll have locally cached docs.
Running Scripts
Save any sequence of commands in a file with the .ps1
extension. For example, create a tiny script:
echo 'Write-Output "Hello from PowerShell on macOS!"' > hello.ps1
Inside the PowerShell session, execute it with:
./hello.ps1
By default, PowerShell’s execution policy is already permissive on macOS. If you ever encounter an execution‑policy warning, run Get-ExecutionPolicy
to check the current level and use Set-ExecutionPolicy
to adjust (e.g., RemoteSigned) as needed.
Integrating with Your Workflow
PowerShell pairs nicely with cross‑platform tools such as Git, Docker, and the Azure CLI. Because cmdlet output is object‑based, you can perform advanced filtering in a single line—think Get-Process | Where-Object CPU -gt 50 | Sort-Object CPU -Descending
. For daily work, consider installing the PowerShell extension in Visual Studio Code; it offers IntelliSense, inline debugging, and syntax highlighting for .ps1
files.
Conclusion
With Homebrew handling the installation and a quick pwsh
command to start, macOS users can enjoy the same versatile shell that Windows administrators have relied on for years. Once you’re comfortable with object pipes, rich help, and cross‑platform scripting, you’ll find PowerShell a powerful ally in automating macOS tasks, managing cloud infrastructure, and keeping workflows consistent across every machine you touch. Give it a try, and watch your terminal efficiency soar.
0 Comments