8

I have just begun to code so everything is new to me. I have started using VS Code with Python 3.11 and macOS Monterey 12.6. However, very soon I discovered that when I enter the "code" command at the terminal command line, it comes back "command not found."

I have to go the command palette, uninstall the code command and then reinstall it for it to work. The problem with this is that it resets everytime I close VS Code so I have to go back and repeat the whole process of unstalling and reinstalling the code command. I have read some other posts on stackoverflow that seem to address this issue but my knowledge of programming is extremely rudimentary and I was unable to understand the answers provided. Any help would be much appreciated. Thank you.

2 Answers 2

43

Maybe this will work:

  1. open vscode
  2. press cmd + shift + P
  3. type shell command: install 'code' in PATH
  4. type code . in your project folder
Sign up to request clarification or add additional context in comments.

4 Comments

Thank you. I don't believe that worked, but I found another way. It was just a matter of pasting the following into the command line: export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin" EOF That did the trick.
you will likely need to run source ~/.bash_profile in the terminal session you're running the git mergetool from
had the same problem, this fixed my issue. Thanks
I too had the same issue, this fix worked perfectly. Thankyou
9

I had the same problem.

After much searching, I discovered the reason was because I was launching VScode from the Downloads folder, and the "code" command was installing in another location. Therefore, what you can do to fix this error is to move the Visual Studio Code.app installation file into the Applications folder.

Then you reopen VScode, uninstall, and then reinstall the code command.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.