In this post I’m going to explain how to solve the error “Unable to find powershell!” in VS code when you are using a Mac. When using a Mac to edit powershell scripts in VS Code you are likely to run into the following error message: “Unable to find Powershell! Do you have it installed? You can also configure custom installations with the ‘powershell.powerShellAdditionalExePaths’ setting.”
So how do you solve this error?
The problem is caused because VS Code is unable to find Powershell. This could be because Powershell is not installed or VS Code is not looking at the location where you installed Powershell.
1. Make sure Powershell has been installed on your Mac. If not you can use the following Microsoft guide to install Powershell
2. If Powershell is already installed you need to add the path in VS Code. Open Terminal and enter whereis pwsh to find the path and copy the path.
3. Open VS Code and go to preferences and then select settings.
4. In the search settings field, enter “powershell.powerShellAdditionalExePaths” and press “Add item”
5. You must enter an item and a value. In Item you can enter a name for recognition and in value you enter the powershell location you copied.
6. Restart VS Code and open a powershell file. A powershell Terminal will open without the warning.
Sources:
Using Visual Studio Code for PowerShell Development