Visual Studio Code is an excellent developer tool for PowerShell projects. However, regardless of which type of project you’re developing (C#, Node.js, Python, etc.), you can benefit from changing your default shell to the powerful, object-oriented PowerShell shell. Now, you may not want to change your default shell for the entire operating system. VSCode thankfully exposes a configuration option that allows you to change the default shell only for the VSCode Integrated Terminal. This won’t affect the default shell for your host operating system.
To change your default shell for VSCode to PowerShell Core, simply:
- Install Visual Studio Code
- Install PowerShell Core
- Hit CMD + , (Mac OS X) to open your User Settings, or search for it via the Command Palette (F1 key)
- Add the terminal.integrated.shell.osx option to your JSON configuration
- Set the value of the option to /usr/local/bin/powershell
If PowerShell Core is installed to a different location, you can use the which powershell command from a Bash or ZSH shell to locate the binary. Then, populate the path accordingly in your VSCode User Settings configuration. If you’re using Linux or Windows, instead of Mac OS X, then you’ll simply replace the terminal.integrated.shell.osx setting with terminal.integrated.shell.linux or terminal.integrated.shell.windows. VSCode’s User Settings supports JSON schema Intellisense, so as you type the setting, it will auto-complete for you.
Here’s what my current User Settings file looks like.
As you can see, now that I’ve changed my default shell, hitting CTRL + ` (backtick) results in a shiny new PowerShell instance directly inside of VSCode!