'zsh: command not found: ng' in Visual Studio Code's integrated terminal on Mac Catalina

Viewed 6922

Newer Macs (Catalina OS in my case) now have the default Z Shell aka zsh. Using a Mac zsh terminal window, I've successfully installed Angular 11.0.5 globally and created a project. I'm using nvm 0.32.2 and node 10.23.0.

However, on opening Visual Studio Code and navigating to my project within VS Code's integrated terminal, I get this error message using any ng command, such as trying to generate a component:

zsh: command not found: ng

Does anyone know how to properly set up Visual Studio Code's integrated terminal to properly identify ng commands using zsh?

I've found one possible work around here https://stackoverflow.com/a/58584109/6647188 but it uses third party tools which I'd like to avoid if possible. Is there no other known way to resolve this?

6 Answers

Here is the settings that worked for me

  "terminal.integrated.defaultProfile.osx": "zsh",
  "terminal.integrated.profiles.osx": {
    "tmux": {
      "icon": "terminal-tmux",
      "path": "tmux"
    },
    "zsh": {
      "path": "/bin/zsh"
    }
  },
  • Sertings -> Features -> Terminal

  • Click in "Edit in settings.json”

  • Add this line(key value) to the object:

    "terminal.integrated.shell.osx": "/bin/zsh"
    
  • Close and relaunch Visual Code.

If this line does not work for you:

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

Then try replacing "zsh" with "bash", like so:

"terminal.integrated.shell.osx": "/bin/bash"

New suggested way by vscode:

This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile 
in `#terminal.integrated.profiles.osx#` and setting its profile name as the default 
in `#terminal.integrated.defaultProfile.osx#`. 

This will currently take priority over the new profiles settings but that will change in the future.
Related