VSCode Tasks - Specifying custom PATH

github logo ・1 min read

macOS Catalina opts for zsh as the default shell in place of bash.
This shift had me running into a weird issue with my custom VSCode Tasks where the tasks were throwing a zsh:1: command not found error.

I set default login shell to zsh for my macOS user and set up VSCode to use zsh as the default shell for integrated terminal.

Tried adding export PATH=$PATH:<mypath> to my ~/.zshrc but that didnt help either.

Ultimately I ended up specifying the PATH as a custom env variable in the VSCode task options

"tasks": [
    {
        "label": "Project Name",
        "type": "shell",
        "command": "appc ti project id -o text --no-banner",
        "options": {
            "env": {
                "PATH": "<mypath>:${env:PATH}"
            }
        }
    }
]
twitter logo DISCUSS
Classic DEV Post from Apr 12

Introducing The Recursive `Pipe` and `Compose` Types

It turns out, the recursive Pipe (and Compose) types offer key advantages over ...

Nirmal Patel profile image
Always learning