Integrated terminal in VSCode not allowing me to use zsh

115 views Asked by At

I am running VSCode 1.87.2 on Pop!_OS 22.0.4, kernel version 6.6.10-76060610-generic

UPDATED

A lot of commands (such as sudo,apt,docker) do not work when in the integrated shell in VS Code. Example response: bash: sudo: command not found

When I type the full path to say apt I get this:

$ mmurphy@pop-os:~$ /usr/bin/apt
$ bash: /usr/bin/apt: No such file or directory

Integrated terminal (VSCode) not recognizing commands that work in standalone Terminal app

I recently reinstalled the OS and I did not install anything other than VS Code and Chrome.

Note before I got new hardware and installed 22.0.4 on it I had been using 21 with it being my primary dev environment so I had using the integrated shell for a long time.

1

There are 1 answers

0
VonC On

There have not been many reports of this issue in VSCode, except maybe issue 207117: "User-defined PATH no longer sourced in remote ssh session after 1.87.1 release".

From the image you have shared in the chat, it is clear that packer is working correctly when invoked from a shell outside VSCode, and you have verified its location with which packer showing /usr/bin/packer. The permission appears to be correct as well.

Test first .bashrc, .zshrc, or any other relevant startup scripts are being sourced correctly (add an echo to follow their activation).
Open the preferences (Preferences: Open Settings (JSON)) and look for the terminal.integrated.env.linux and terminal.integrated.shellArgs.linux settings. There might be some environment configurations overriding the default behavior.

Also, disable any VSCode extensions that might be interacting with the terminal environment, then restart VSCode to see if the issue persists.

Check your Terminal: Select Default Profile, and make sure that the correct shell profile (e.g., bash or zsh) is selected.

In both the integrated terminal and the standalone terminal, run env | sort and compare the outputs to see if there are discrepancies in the environment variables.

Sometimes, forcing the shell to run as a login shell within VSCode can make sure all startup files are sourced correctly: modify the terminal.integrated.shellArgs.linux setting in VSCode to include -l (e.g., ["-l"] for bash or zsh).