0

How can I concatenate my $PATH variable to have code command working, on VSCode? On their website it says to add the following line to ~/.zprofile

export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"

but my ~/.zprofile already has the following line:

PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"

I have tried to just add this first entry below the first PATH declaration but it broke everything, no command like cat open or vim was working, so I have tried to just concatenate it like so

PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"

But it did not work. I have VSCode in my applications folder, I ran shift+command+p and from there I have added vscode to the path and nothing.

Thanks

avocadoLambda
  • 1,332
  • 7
  • 16
  • 33
seven
  • 1,183
  • 14
  • 33
  • I have also tried adding following line before end of ~/.zshrc file but with no effect export PATH="~/Applications/Visual Studio Code.app/Contents/Resources/app/bin:$PATH" – seven Aug 01 '21 at 15:58
  • 2
    If you're editing that command directly into your `~/.zprofile` (as opposed to adding it with something like `echo export ...` or something), then the backslash shouldn't be there. That is, edit the line `export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"` into your `~/.zprofile`. P.s. can you link to exactly where on the website to use the form you had? – Gordon Davisson Aug 01 '21 at 19:40
  • 1
    `zsh` provides the much simpler `path+=(newdirectory)`. You don't have to worry about providing the old value or the `:` delimiter. – chepner Aug 01 '21 at 20:57
  • @Seven : The part `${PATH}\$PATH` does not make any sense to me. What would you like to achieve with this? – user1934428 Aug 02 '21 at 10:32
  • 1
    How about y'all start writing answers instead of comments? Then the question wouldn't stay open and you would make it easier for anyone with the same problem in future to find the right answer. This is, after all, a question and _answer_ site. – Marlon Richert Aug 02 '21 at 19:43
  • @user1934428 I would like to be able to run vscode with code command – seven Aug 02 '21 at 21:39
  • @Seven : In this case, you have to add the directory, where the `code` command is stored, to your `path`, like chepner said. This applies to **any** executable you want to call without providing an absolute path explicitly and is not specific to vscode. – user1934428 Aug 03 '21 at 04:25
  • Does this answer your question? [Adding a new entry to the PATH variable in ZSH](https://stackoverflow.com/questions/11530090/adding-a-new-entry-to-the-path-variable-in-zsh) – user1934428 Aug 03 '21 at 04:27

0 Answers0