Fixing the 'PowerShell session not found' issue in VS Code
3 October 2025 by Brady Stroud
Recently, I was working with some PowerShell scripts in VS Code and ran into a frustrating error:
"Can't find the PowerShell session."
After some digging, I discovered the fix: VS Code couldn't locate my PowerShell executable. The solution was to point VS Code directly to the PowerShell exe path in the settings.
How to Fix It
- Open VS Code Settings (
Ctrl + ,orCmd + ,on Mac). - Search for
powershell.exeor PowerShell: Executable Path. - Manually set the path to your PowerShell installation.
Where to Find PowerShell (if installed with Homebrew)
If you've installed PowerShell via Homebrew, here's where you'll find it on macOS:
/usr/local/bin/pwsh(or /opt/homebrew/bin/pwsh if you're on Apple Silicon).
That's the file path you'll want to paste into VS Code's PowerShell settings.
Thats all - once you set the correct path, restart VS Code and the error should be gone. Happy scripting!