How to Install VS Code on macOS and Add the Code Command to PATH

Install VS Code on macOS with Apple silicon or Intel, then add the code shell command so you can open any folder from the terminal with code .

4 min read

⚠ This article has a formatting issue and may not display correctly.

Our team has been notified. The content is shown as plain text below.

Installing on macOS takes two steps: drag the app to Applications, then add the shell command so you can open projects from the terminal. This editor runs on both Apple silicon and Intel Macs. The download page gives you a Universal build that works on either. ## Choose your build | Mac type | Recommended download | |---|---| | Apple silicon (M1, M2, M3, M4) | Universal or Apple silicon build | | Intel | Universal or Intel build | | Unsure | Universal build (works on both) | Go to [code.visualstudio.com/download](https://code.visualstudio.com/download). The site detects your Mac type and highlights the right button. Click the arrow next to the button to see all build options. ## Install the app Download the disk image Go to [code.visualstudio.com/download](https://code.visualstudio.com/download) and click the **Mac** download button. The file downloads to your Downloads folder. Open the disk image Double-click the downloaded file. A Finder window opens showing the VS Code icon and a shortcut to the Applications folder. Drag VS Code to Applications Drag the app icon into the Applications folder shortcut. macOS copies it. If you skip this step and run from the disk image, it works but updates may not apply correctly. Always install to Applications. Open and pin the app Open the Applications folder in Finder and double-click the app. The first launch may show a security prompt. Click **Open** to confirm. You can eject the disk image now. In Finder, click the eject icon next to "VSCode" in the sidebar. To keep the editor in the Dock for quick access, Control-click the icon in the Dock and select **Options** > **Keep in Dock**. ## Add the shell command The shell command lets you open the editor from the terminal. Type `code .` in any folder to open it. Type `code myfile.js` to open a specific file. Open the Command Palette With the editor open, press **Cmd+Shift+P**. The Command Palette appears at the top of the window. Run the shell command installer Type `shell command` in the Command Palette and select **Shell Command: Install 'code' command in PATH**. A notification confirms it was installed. Restart your terminal Close and reopen Terminal or iTerm. The terminal needs to reload its PATH before the command becomes available. Test the command In a new terminal window, type `code --version` and press Enter. You should see the version number, commit ID, and platform string. Now navigate to any folder and type `code .` to open it. ## Manual PATH setup If the Shell Command option does not work, add the path manually. Open Terminal and run the command for your shell. Here is the command for Zsh, which is the default since macOS Catalina: cat > ~/.zprofile # Add Visual Studio Code (code) EOF This appends the editor's binary path to your shell profile. The backslash before the PATH variable prevents it from expanding during the append. For Bash, the same approach works with the profile file changed: cat > ~/.bash_profile # Add Visual Studio Code (code) EOF Close and reopen the terminal, then test with `code --version`. ## Verify everything works After installation and PATH setup, run a quick test. - Open Terminal. - Create a test folder: `mkdir ~/Desktop/vscode-test`. - Move into it: `cd ~/Desktop/vscode-test`. - Type `code .` and press Enter. The editor opens with the test folder loaded. Create a new file, type some text, and save it. Both the editor and shell command are working. Delete the test folder when done: `rm -rf ~/Desktop/vscode-test`. ## Next steps The editor is installed and the shell command is ready. Now set up essential settings, install language extensions, sign in to GitHub Copilot, and create your first project. Start with the [beginner setup guide](/vscode/vs-code-setup-for-beginners-essential-settings-extensions-and-first-project). If you also work on other platforms, see the [Windows 11 install guide](/vscode/how-to-download-and-install-vs-code-on-windows-11).
Rune AI

Rune AI

Key Insights

  • Download the .dmg from code.visualstudio.com, open it, and drag VS Code to Applications.
  • Run the Shell Command: Install code command in PATH from the Command Palette (Cmd+Shift+P).
  • Restart your terminal after adding the command, then test with code --version.
  • VS Code updates itself automatically. Accept the prompt when a new version is available.
RunePowered by Rune AI

Frequently Asked Questions

Does VS Code run on Apple silicon Macs?

Yes. VS Code runs natively on both Apple silicon (M1, M2, M3, M4) and Intel Macs. The download page offers a Universal build that works on both, plus separate Apple silicon and Intel builds if you prefer a smaller download.

Why does code say command not found after installing?

The terminal caches the old PATH. Restart your terminal after running the Shell Command: Install code command in PATH command. If it still does not work, open the Command Palette again and confirm the command ran without errors.

How do I update VS Code on macOS?

The editor checks for updates automatically. When a new release is available, it shows a prompt. Accept the prompt to install it. You can also check manually from Code > Check for Updates in the menu bar.

Conclusion

VS Code is installed on macOS and the code shell command is ready. Open any folder with code . and start editing. For the next step, set up essential settings, install a few extensions, and create your first project.