Install PowerShell on macOS with Homebrew, run it as pwsh, then pair it with Visual Studio Code for the cleanest editing and debugging setup. That is the shortest path to a useful PowerShell 7 workflow on a Mac. Microsoft officially supports PowerShell 7 on macOS, including Apple silicon builds, and Homebrew keeps the install simple with one command [source: Microsoft].
TLDR: Install Homebrew, run brew install --cask powershell, start PowerShell with pwsh, then install Visual Studio Code and the official PowerShell extension. For example, a Mac admin can test a 40-line user cleanup script locally, edit it in VS Code, and run the same script later on Linux or Windows with only small path changes. In a mixed team of 10 people, that can easily save hours each month because everyone uses the same shell, editor, and module syntax.
Why run PowerShell on macOS?
PowerShell is no longer just a Windows admin tool. PowerShell 7 is cross-platform, built on modern .NET, and works on macOS, Linux, and Windows. That makes it useful for people who manage cloud systems, Microsoft 365, Azure, Git repositories, APIs, or a fleet of mixed devices.
On macOS, it gives you a practical bridge between Unix-style commands and PowerShell objects. You can still use ls, cat, grep, and ssh, but you also get cmdlets like Get-Process, Invoke-RestMethod, ConvertTo-Json, and ForEach-Object. Honestly, it feels like cheating when a messy API response becomes usable with one pipeline.
Step 1: Install Homebrew
If Homebrew is already installed, skip ahead. If not, open the macOS Terminal app and run the official install command from the Homebrew website. It usually looks like this:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After installation, Homebrew may show extra commands to add it to your shell profile. Pay attention here. This is one of those small setup steps that causes annoying “command not found” errors later.
On Apple silicon Macs, Homebrew usually lives here:
/opt/homebrew/bin/brew
On older Intel Macs, it usually lives here:
/usr/local/bin/brew
Check that Homebrew works:
brew --version
If you get a version number, you are ready.
Step 2: Install PowerShell 7 with Homebrew
Now install PowerShell with Homebrew Cask:
brew install --cask powershell
When it finishes, start PowerShell:
pwsh
Your prompt should change. You are now inside PowerShell 7. Run this to confirm the version:
$PSVersionTable
Look for PSVersion, OS, and Platform. You should see macOS listed. That confirms you are not using the older Windows-only PowerShell model from years ago.
To leave PowerShell and return to your normal shell, type:
exit
Step 3: Update PowerShell later
Do not download random installer files every few months. Let Homebrew handle updates.
brew update
brew upgrade --cask powershell
That updates Homebrew’s package data first, then upgrades PowerShell if a newer version is available. It is boring, which is exactly what you want from a package manager.
Step 4: Install Visual Studio Code
You can install Visual Studio Code from the website, but Homebrew is cleaner if you are already using it:
brew install --cask visual-studio-code
Open VS Code from Applications, or use:
code
If the code command does not work, open VS Code, press Command Shift P, then search for Shell Command: Install ‘code’ command in PATH. It drives me crazy that this is still a manual step on some fresh installs, but it only takes a few seconds.
Step 5: Add the PowerShell extension
VS Code becomes much more useful once you add Microsoft’s PowerShell extension. You can install it from the Extensions panel by searching for PowerShell, or run:
code --install-extension ms-vscode.PowerShell
The extension adds syntax highlighting, IntelliSense, script analysis, debugging, snippets, and an integrated PowerShell terminal. It is the difference between typing in a plain text box and using a real scripting workspace [source: Visual Studio Marketplace].
Step 6: Set PowerShell as the default terminal in VS Code
Open the Command Palette with Command Shift P. Search for Terminal: Select Default Profile. Pick PowerShell. Open a new terminal in VS Code with:
Control `
You should see a pwsh session. If you do not, check where PowerShell is installed:
which pwsh
Common results are:
/opt/homebrew/bin/pwshon Apple silicon/usr/local/bin/pwshon Intel Macs
If VS Code cannot find it, restart VS Code after installing PowerShell. GUI apps on macOS sometimes miss fresh PATH changes until they are reopened.
Create and run your first script
Create a folder for scripts:
mkdir ~/powershell-lab
cd ~/powershell-lab
code .
In VS Code, create a file named system-report.ps1. Add this:
$report = [PSCustomObject]@{
ComputerName = $env:COMPUTERNAME
User = $env:USER
Shell = $PSVersionTable.PSVersion.ToString()
Date = Get-Date
Processes = (Get-Process).Count
}
$report | Format-List
Run it in the VS Code terminal:
pwsh ./system-report.ps1
On macOS, $env:COMPUTERNAME may be empty, depending on your setup. A more Mac-friendly version can use:
scutil --get ComputerName
This is a good reminder: PowerShell is cross-platform, but your operating system still matters. Paths, environment variables, available tools, and file permissions can differ.
Useful commands for daily work
Once PowerShell is running, try these commands:
Get-Commandshows available commands.Get-Help Get-Processopens help for a cmdlet.Get-Process | Sort-Object CPU -Descending | Select-Object -First 10lists busy processes.Invoke-RestMethod https://api.github.comtests a web API call.Get-ChildItem -Recurselists files below the current folder.
You can also install modules from the PowerShell Gallery:
Install-Module Az -Scope CurrentUser
That example installs the Azure PowerShell module for the current user only. No admin rights needed.
Common macOS issues
Permission errors: If a script needs execute permission, use:
chmod +x ./script.ps1
Still, many PowerShell scripts can run directly with:
pwsh ./script.ps1
Path problems: macOS uses forward slashes, like /Users/alex/scripts. PowerShell handles many path formats, but scripts written for C:\ paths need edits.
Case sensitivity: Most macOS volumes are case-insensitive by default, but not all. If a script references Data.json while the file is named data.json, expect trouble on stricter file systems.
A clean setup pays off
The best macOS PowerShell setup is simple: Homebrew for installation, PowerShell 7 for the shell, and VS Code for writing scripts. It is easy to update, easy to repeat on another Mac, and close enough to Windows and Linux workflows to support real cross-platform automation. Once it is in place, you can stop fighting your tools and start writing scripts that actually save time.