The most common way to open Visual Studio Code from the command line on OSX is by using the code command. If you have installed Visual Studio Code and added the code command to your PATH, you can follow these simple steps:
- Open the Terminal.
- Use the
cdcommand to navigate to the project folder. For example, if your project is in theMyProjectfolder on theDesktop, you can enter:bashcd ~/Desktop/MyProject - In the target folder, enter the
code .command to open Visual Studio Code:
This command opens the current directory in Visual Studio Code.bashcode .
If the code command is not available, you may need to install or enable the command-line tool in Visual Studio Code. Follow these steps to set it up:
- Open Visual Studio Code.
- Use the shortcut
Shift + Command + Pto open the command palette. - Type
Shell Command: Install 'code' command in PATHand select it.
This will install the code command to your system PATH, after which you can use it in the terminal as described.
2024年8月10日 01:28 回复