“code .” Not working in Command Line for Visual Studio Code on OSX/Mac

前端 未结 25 2221
日久生厌
日久生厌 2020-12-12 09:13

The command \"code .\" doesn\'t work in this manual?

All the other steps before that worked. How can I call the Visual Studio Code in OSX terminal?

         


        
相关标签:
25条回答
  • 2020-12-12 09:43

    It might be possible that you have not installed the code in your system. So, please install it first. the command is here -

    sudo snap install --classic code
    

    Details are available is here

    0 讨论(0)
  • 2020-12-12 09:44

    On my MAC I got it working:

    add to .bash_profile

    code() {
       open -a Visual\ Studio\ Code.app $1
    }
    

    save and in terminal 'source .bash_profile'

    Then in terminal code index.html (or whatever) will open that file in VS Code.

    0 讨论(0)
  • 2020-12-12 09:45

    For Mac OSX: There is a way to install Visual Studio Code through Brew-Cask.

    1. First, install 'Homebrew' from here.
    2. Now run following command and it will install latest Visual Studio Code on your Mac.

      $> brew cask install visual-studio-code

    Above command should install Visual Studio Code and also set up the command-line calling of Visual Studio Code.

    If above steps don't work then you can do it manually. By following Microsoft Visual Studio Code documentation given here.

    0 讨论(0)
  • 2020-12-12 09:46

    for the people who face the same problem in Windows - 10 please follow the below instructions,

    https://github.com/Microsoft/vscode/issues/21957

    It might be the case that, C:\Program Files (x86)\Microsoft VS Code\bin is missing in environment variables., kindly look into the following image for the solution, https://cloud.githubusercontent.com/assets/4076309/23575794/61d7cc2a-00b9-11e7-843b-bcd6f00f595f.png

    0 讨论(0)
  • 2020-12-12 09:46

    I was having the same problem. I have to add Vs Code to my applications folder. It worked without editing a file.

    1. Open Applications Folder

    1. Search for VS Code in your search

    1. Drag Vs Code to the applications folder

    This will work for you.

    0 讨论(0)
  • 2020-12-12 09:47

    This work for me:

    sudo ln -fs "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" /usr/local/bin/
    
    0 讨论(0)
提交回复
热议问题