Change default terminal app in Visual Studio Code on Mac

I want to change the default terminal app used by Visual Studio Code for Mac. I am thinking it is part of preferences or settings json, but unsure.

97768 次浏览

Here's an example of how to make another terminal the default for VSCode, in this example I've downloaded iTerm2 and copied iTerm2 to Applications.

  1. Code (Menu) > Preferences > User Settings

enter image description here

  1. Edit settings.json "terminal.external.osxExec": "iTerm.app" and "terminal.explorerKind": "external"

enter image description here

  1. Open in Terminal

enter image description here

  1. iTerm is now default terminal launched from VSCode

enter image description here

From visual studio code blog:

// 64-bit cmd it available, otherwise 32-bit
"terminal.integrated.shell.windows":"C:\\Windows\\sysnative\\cmd.exe"
// 64-bit PowerShell if available, otherwise 32-bit
"terminal.integrated.shell.windows":"C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
// Git Bash
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
// Bash on Ubuntu (on Windows)
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"

Reference: Integrated Terminal

well I know it's so late, but you could just change it by running command

Terminal: Select Default Shell

its so much easier

For those that want to change the default integrated terminal NOT just the external, and add custom themes, show which git branch you are on, and whether or not files need to be staged or committed for example.

Follow these short steps:

Make sure you have these installed:

iTerm2, oh-my-zsh

Install a powerline font (I am using Menlo which is a nice looking and very popular font).

Go here and click on download

Open the file

Click on install font

(Note: without this, vscode integrated terminal will not render themes correctly)

Open the .zshrc file by running this command:

cd ~ ; code .zshrc

Change iTerm's theme to agnoster:

Press ⌘f to open search in the .zshrc file

Type ZSH_THEME

Search until you find the live code, NOT the commented out code :)

Edit the code it so it looks like ZSH_THEME="agnoster"

Save the file

Open vscode settings using shortcut:

⌘,

Inside of vscode settings, you will see two panels. On the right panel paste this:

"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.fontFamily": "Menlo for Powerline"

Assuming the settings were empty before, it should now look like this:

{
"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.fontFamily": "Menlo for Powerline"
}

Finished! Enjoy your new pimped out terminal

-(Optional customization)-

If you want your prompt to display something other than your username such as a thunder bolt, like in mine or anything you want

Open agnoster theme by runnning this command:

cd ~/.oh-my-zsh/themes/ ; code agnoster.zsh-theme

Open search by pressing:

⌘f

Paste this in search bar:

prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"

To change your what your prompt displays, edit ONLY this part:

$USER@%m

DO NOT CHANGE this part:

prompt_segment black default "%(!.%{%F{yellow}%}.)

In conclusion, the code should now look something like this:

prompt_segment black default "%(!.%{%F{yellow}%}.) Insert here whatever your heart desires"

(Note: Technically you can change everything about your terminal prompt, but for the sake of keeping this short, and simple we only edited the username part)

I recently changed my terminal in VSCode to ozh, its just 1 step and 1 line.

  1. Open Command Palette using View > Command Palette ( or simply Command + Shift + P )

  2. add the following line to the user settings.

    "terminal.integrated.shell.osx": "zsh"

enter image description here

None of these answers fully worked for me. Here is what I changed to get it to work:

Select the default shell as zsh:

CMD + SHIFT + P to open up the command palette. Then type Terminal: Select Default Shell. You can then select zsh. enter image description here

Change the terminal to use iTerm

enter image description here

Change the font family to use Powerlevel10k

enter image description here

Result

enter image description here

In vscode settings.json add:

"terminal.integrated.profiles.osx": {
"zsh": null
},