Wednesday, May 24, 2017

Integrated Terminal Setting VS Code and iTerm returns zsh

Leave a Comment

I'm trying to use iterm as my focus terminal inside vscode. I've setup "terminal.external.osxExec": "iTerm.app", but I get zsh instead of iTerm. screenshot of terminal in vscode

I'm able to right click on a file and open in iterm but I love the integrated terminal, and want to use iTerm here.

How do I use iterm as my terminal?

2 Answers

Answers 1

You cannot set iTerm as the integrated terminal for VS Code. I have explained below why.

iTerm is not a shell but a terminal emulator which in your case is running the zsh shell.

I believe you are confusing the terms Shell and a terminal emulator.

iTerm is a terminal emulator. Some examples of terminal emulator are Gnome terminal, Guake, Xterm etc. They provide a display to the shell which is installed in the OS.

A shell is a command line interface that reads and interprets your commands. Examples of shell are bash which comes by default in Linux and other shells like zsh, fish, sh.

Visual Studio Code integrated terminals use the shell itself and not the terminal emulator. In Windows OS the distinction between shell and terminal emulator is not present so Powershell and Command Prompt are both the shell and the emulator.

But for Unix like OSes there is a distinction.

I believe you use iTerm as the terminal emulator and the shell used is zsh (pronounced Z Shell which is a fork of bash Bourne Again Shell).

Here is a wikipedia article on Unix Shell. This talks about what a Unix shell really is.

This link is about Terminal emulators which also talks about the history of terminals.

This link gives a list of terminal emulators that are available. iTerm is a terminal emulator for Mac OS.

Answers 2

I'm slightly confused by your question, but I'll do my best to answer it regardless.

Regarding the integrated terminal, you should be able to access it with this shortcut: ctrl + `

From there, you should be able to configure the shell you want to use, and create new instances of the terminal with: ctrl + shift + `

I have a feeling that this isn't new information to you, however. It seems like you're trying to change the shell that the integrated terminal uses by default, which implies that you already know how to use the integrated terminal. (I imagine the comments might have been frustrating for this reason)


A similar question has been asked on SO before, and I'll leave the link for you to explore on your own, but I'll analyze some of the answers for your sake.

Change default terminal app in Visual Studio Code on Mac

As far as setting the default terminal to iterm, you should be able to follow these steps:

  1. Code (Menu) > Preferences > User Settings

enter image description here

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

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

So, what could be going wrong with your configuration?

Well, I'd first check to make sure that your settings.json is correctly configured; if it's set to run iterm but is running zsh, the obvious answer is to check that zsh isn't somehow overriding that default in your settings.json file.

Another place to look would be the steps outlined in the Integrated Terminal Documentation. The answer varies depending on what OS you're using, but you should be able to find the correct settings in that documentation. For the sake of creating a comprehensive answer, I'll synthesize the Windows portion of the documentation.


The shell defaults to PowerShell on Window 10 and cmd.exe on earlier versions of Windows. These can be overridden manually by setting terminal.integrated.shell.* in settings. Below are a list of common shell executables and their default locations:

// 64-bit cmd if 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" 

Of note:

  • To be used as an integrated terminal, the shell executable must be a console application so that stdin/stdout/stderr can be redirected.

  • The integrated terminal shell is running with the permissions of VS Code. If you need to run a shell command with elevated (administrator) or different permissions, you can use platform utilities such as runas.exe within a terminal.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment