"code ." command doesn't work to open Visual Studio Code operator from mac terminal I cannot open Visual Studio Code Editor from command line just by typing "code ." in terminal
Launching from the command line You can also run VS Code from the terminal by typing 'code' after adding it to the path: Launch VS Code. Open the Command Palette (Cmd+Shift+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.
If your terminal is set to run as administrator only, and you are not launching VS Code as administrator, the terminal will not be able to open. You can either change the default terminal or edit the properties of the terminal exe to not run as administrator.
Execute commands in the shell In the Terminal app on your Mac, enter the complete pathname of the tool's executable file, followed by any needed arguments, then press Return.
Launch VS Code
Open View --> Command Palette
Type shell command
and
find Shell Command: Install 'code' command in PATH command
and install (for mac)
find Allow Workspace Shell Configuration
and install (for linux )
Restart the terminal
Go to your folder path and type code .
in terminal.
Visual Code Studio will open with your current folder directory.
Locate your bash profile with the command 'locate bash_profile'.That file is usually located in '/Users/user_name/.bash_profile'.Once you found the file, insert the following command.
"code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}"
After that, save the file and type the following command in the same directory.
See the attached screenshot for more clarity. enter image description here
$source .bash_profile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With