Software⏱️ 2 min read📅 2026-06-02

How to Fix: "code ." is not working in on the command line for Visual Studio Code on OS X/Mac

Fix "code ." is not working in on the comman. Add the path to the Visual Studio Code e. Step-by-step guide included.

Quick Answer: Add the path to the Visual Studio Code executable to your system's PATH variable by running the command "export PATH=\

The issue you're experiencing is due to the fact that the code . command is not a standard Unix command. When you run this command, it's trying to execute a shell script with the same name as your current directory, which doesn't exist.

🚀 How to Resolve This Issue

Method 1: Alias Command

  1. Step 1: Open your terminal and run the following command to create an alias for the Visual Studio Code command:

Method 2: Add Path Variable

  1. Step 1: Open your terminal and run the following command to add the path to the Visual Studio Code executable to your system's PATH variable:

💡 Conclusion

By following these methods, you should be able to resolve the issue and run the code . command successfully in your OS X terminal.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions