Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

VS Code cannot start zsh: Unable to resolve your shell environment (spawn ENOENT)

ErrorUnable to resolve your shell environment: A system error occurred (spawn /user/bin/zsh ENOENT)

Short answer

ENOENT means the program VS Code tried to start does not exist at that path. For zsh it is either your account's login shell, which points to a missing file, or a terminal profile with a wrong path. Install zsh or point both at the real path, which command -v zsh prints.

  • Applies to VS Code on Ubuntu 24.04, zsh 5.9
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    See which shell your account uses, and whether that file exists.

    getent passwd "$USER" | cut -d: -f7
    command -v zsh
  2. 2Match what you see, then jump to its fix

    1. 1The path in the error (for example /user/bin/zsh, with a typo) is the same as the last field of your passwd entry, and ls says it is missingThe login shell in your account points to a missing fileFix
    2. 2The wrong path appears in your settings.json, not in the passwd fileA VS Code terminal profile or default shell has a wrong pathFix

What does the error look like?

  • Unable to resolve your shell environment: A system error occurred (spawn /user/bin/zsh ENOENT)

Cause 1 of 2

The login shell in your account points to a missing file

1Check

chsh changes your login shell, and the shell must be listed in /etc/shells. Compare the account's shell with the zsh that is really installed.

ls -l "$(getent passwd "$USER" | cut -d: -f7)"
cat /etc/shells

2Fix

Install zsh if needed (it is in the main section of Ubuntu 24.04), then set the login shell to the real path.

sudo apt install zsh
chsh -s "$(command -v zsh)"

3Verify

Log out and in again, then check the new shell and start VS Code from the launcher.

getent passwd "$USER" | cut -d: -f7

Confirmed by man7.org

Did this fix it?

Cause 2 of 2

A VS Code terminal profile or default shell has a wrong path

1Check

Terminal profiles are defined in terminal.integrated.profiles.linux with a path, and the default is chosen with terminal.integrated.defaultProfile.linux.

grep -n 'terminal.integrated' ~/.config/Code/User/settings.json

2Fix

Correct the path of the profile to the one command -v zsh printed.

"terminal.integrated.profiles.linux": {
  "zsh": { "path": "/usr/bin/zsh" }
},
"terminal.integrated.defaultProfile.linux": "zsh"

3Verify

Open a new integrated terminal.

echo $SHELL

Confirmed by code.visualstudio.com

Did this fix it?

How do I stop it coming back?

  • Change your login shell with chsh, not by editing the passwd file by hand.
  • Use the path printed by command -v zsh when you write a terminal profile.
  • After moving a user between machines, check that the shell in the account exists there.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.