How-to · VS Code for Mac

How to install the code command in VS Code on Mac: Command Palette steps

To install the code command in VS Code on Mac, open the Command Palette with ⇧⌘P, run "Shell Command: Install 'code' and optionally 'copilot' commands in PATH", then restart Terminal. Type code . in any project folder to test it, and VS Code opens that folder.

Updated Checked against VS Code desktop app on macOS, Apple silicon and Intel Macs5 minEasy

Developer at a Mac learning how to install the code command in VS Code on Mac
Setting up a code editor on a Mac · Image by StockSnap from Pixabay

Quick answer

  • Open the Command Palette with ⇧⌘P while VS Code is the active app.
  • Run Shell Command: Install 'code' and optionally 'copilot' commands in PATH.
  • At the Copilot CLI prompt, Yes adds code and Copilot CLI, No adds only code, and Escape adds neither.
  • Quit and reopen Terminal, then run code . inside a project folder to test.
  • If the command is missing, add VS Code's bin folder to your shell profile by hand.

What you need

  • VS Code desktop app for Mac, in your Applications folder
  • A Mac with Apple silicon or an Intel chip
  • Access to Terminal, found in Applications > Utilities
  • A project folder to test with, such as ~/Documents/my-project

How to Install the code command in VS Code on Mac in VS Code on a Mac

  1. Open VS Code from Applications

    FinderApplicationsVisual Studio Code

    Open the downloaded .dmg file, drag Visual Studio Code into the Applications folder, then open the app from there. The download page lists Universal, Intel chip, and Apple silicon builds, so pick the one that matches your chip.

    Tip: Eject the disk image after you drag the app, so you do not launch VS Code from it by mistake.

  2. Open the Command Palette

    ViewCommand Palette⇧⌘P

    Click the VS Code window so it is active, then press ⇧⌘P. A search box opens near the top of the window.

    Tip: If the shortcut does nothing, click inside the VS Code window first. You can also choose View > Command Palette from the menu bar.

  3. Find the Shell Command

    Type shell command in the search box. Choose Shell Command: Install 'code' and optionally 'copilot' commands in PATH from the list, then press Return.

    Tip: The older label, Shell Command: Install 'code' command in PATH, appears only when AI features are hidden or your organization disables Copilot CLI installation.

  4. Answer the Copilot CLI prompt

    If VS Code asks about GitHub Copilot CLI, choose Yes to install Copilot CLI and the code command. Choose No to add only code. Press Escape to install neither command.

    Tip: Yes starts the Copilot CLI install in an integrated terminal. Let it finish before you close VS Code.

  5. Wait for the success message

    Wait for the message that says the code command is installed. That message does not confirm that Copilot CLI finished, because Copilot CLI installs separately from PATH.

    Tip: If you chose Yes, watch the integrated terminal until it shows the install is done.

  6. Quit and reopen Terminal

    TerminalQuit Terminal⌘Q

    Quit Terminal completely, then open it again. A new PATH value only takes effect in a new session, so an open window keeps the old setting.

    Tip: Find Terminal in Applications > Utilities, or search for it with Spotlight.

  7. Move into a project folder

    Run cd ~/Documents/my-project in Terminal. Replace the path with a folder you use. The cd command moves Terminal into that folder.

    Tip: Drag a folder onto the Terminal window to paste its path after cd, which saves typing.

  8. Run code .

    Type code . and press Return. The dot means the current folder, so VS Code opens that folder as a workspace.

    Tip: If Terminal says command not found, go to the troubleshooting list and try the manual PATH steps.

  9. Check the workspace

    Look at the window title and the file list on the left. If your project files appear, the command works. Close the window when you finish.

    Tip: Run code . again inside a second folder to confirm it opens each folder you pick.

  10. Check which shell you use

    Run echo $SHELL in Terminal to see which shell you use. A result ending in zsh means you need ~/.zprofile. A result ending in bash means you need ~/.bash_profile.

    Tip: Only do this if the Shell Command did not work. Otherwise you can skip the manual steps.

  11. Add the PATH line to your profile

    For Zsh, run echo 'export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"' >> ~/.zprofile. For Bash, use ~/.bash_profile in place of ~/.zprofile.

    Tip: Run the line only once. Check the file with cat ~/.zprofile first, so you do not add it twice.

  12. Open a new terminal and test

    Quit Terminal, open it again, then run which code. If it prints a path, the command is on PATH. Then run code . in a folder to confirm VS Code opens it.

    Tip: Insiders builds use code-insiders instead of code. Test with that name instead.

What the code command does on a Mac

The code command is a launcher. You type it in Terminal, and it opens VS Code. Type code . inside a project folder, and the editor opens that folder as a workspace. Without the command, you open VS Code from Applications and hunt for the folder by hand.

VS Code ships weekly releases and updates itself. You set up the command once, then use it from any folder on your Mac. That is the whole point of the setup, so it is worth doing right the first time.

Developer at a Mac learning how to install the code command in VS Code on Mac
Setting up a code editor on a Mac · Image by StockSnap from Pixabay

Check your Mac and your VS Code app first

You need the desktop app. The web version at vscode.dev runs in a browser and has no terminal, so it cannot give you a code command. Install the Mac app from the official download page first.

The download page lists Universal, Intel chip, and Apple silicon builds. Pick the build that matches your chip. If you are unsure, the Universal build covers both chip types. Not sure which chip you have? Choose Apple menu > About This Mac and read the chip name.

  • VS Code sits in your Applications folder, not still inside the downloaded disk image.
  • You have opened VS Code from Applications at least once.
  • The Command Palette opens when you press ⇧⌘P in the VS Code window.
  • You know whether you use zsh or bash, in case you need the manual steps.

Run the Shell Command from the Command Palette

The Command Palette holds most of VS Code's commands. Open it with ⇧⌘P while the VS Code window is active. A search box appears near the top of the window. Type shell command, and the list narrows to a few matches.

Pick Shell Command: Install 'code' and optionally 'copilot' commands in PATH. The official Mac setup page gives this as the current command. Press Return to run it.

What the Copilot CLI prompt means

After you run the Shell Command, VS Code may ask about GitHub Copilot CLI. Your answer decides what gets installed. Check the table, then pick the answer that matches what you need.

Choices at the Copilot CLI prompt, per the VS Code Mac setup docs.
Your answerWhat gets installedPick it when
YesCopilot CLI and the code commandYou want the Copilot CLI tool too
NoThe code command onlyYou want code and nothing else
EscapeNeither commandYou want to decide later

The success message only confirms the code command. The docs warn that Copilot CLI installs separately from PATH. Wait for the Copilot CLI terminal to finish before you assume it worked. If you do not use Copilot, choose No and skip the extra install.

Test the code command in Terminal

A new PATH value only takes effect in a new Terminal session. The docs say to restart the terminal, so do that now. Quit Terminal with Terminal > Quit Terminal or ⌘Q. Then reopen it from Applications > Utilities > Terminal.

Move into a folder. For example, run cd ~/Documents/my-project, and replace the path with your own folder. Then run code . and press Return. The dot stands for the current folder.

VS Code should open that folder as a workspace. Look at the window title and the file list on the left. If your project files appear, the command works.

The FAQ adds one detail. Typing code with no folder opens VS Code with your last workspace. Typing code . opens the folder you are standing in, which is the test you want.

Set up PATH by hand if the command is missing

Sometimes the Shell Command is missing from the list. You may see the older label, Shell Command: Install 'code' command in PATH. That label only appears when AI features are hidden or your organization disables Copilot CLI installation. In that case, the command skips the Copilot prompt.

The manual route adds VS Code's bin folder to your shell profile. Zsh reads ~/.zprofile. Bash reads ~/.bash_profile. Run echo $SHELL in Terminal to see which shell you use, then pick the matching file.

MacBook on a desk with a code editor open, the setup for how to install the code command in VS Code on Mac
A Mac set up for editing code · Image by StockSnap from Pixabay

Add the export line to that file, then open a new Terminal window. Run which code. If it prints a path, the command is on PATH. Then run code . in a folder as before.

Common mistakes when you install the code command

  • Forgetting to restart Terminal, so the old PATH stays loaded in the open window.
  • Adding the export line twice. Check the file with cat before you edit it again.
  • Keeping an old code alias from an earlier VS Code version in your shell profile.
  • Typing code in Insiders when the Insiders command is code-insiders.
  • Opening vscode.dev and looking for a terminal that the web version does not have.

VS Code Insiders, the web version, and other edge cases

VS Code Insiders is a separate preview build. Its command is code-insiders instead of code. The docs say to use that name for Insiders builds. If you run both editions, you can keep both commands and test each one by its own name.

Shell profiles cause the most confusion. If you are not sure which file your Terminal reads, add the line to the file that matches your shell. Then open a new window and check with which code. A blank result means the line did not load.

The web version runs in your browser. The docs say the terminal is not available there, and the browser sandbox limits what code can run. That is why this command is a desktop feature. This is an inference from the web docs, not a line the docs state directly.

How many developers use VS Code on Mac

75.9%

of all 2025 Stack Overflow survey respondents said they use Visual Studio Code

Stack Overflow Developer Survey 2025: Technology

In the 2025 Stack Overflow Developer Survey, 75.9% of all respondents said they use Visual Studio Code. Visual Studio, a different product, came in at 29%. The IDE question drew 26,143 responses, which the survey lists as 53.3% of respondents.

Those numbers measure general use. They say nothing about how many people run the code command. Treat them as context only, not as proof that the command setup is easy.

Next steps after the code command works

Keep your test folder. Run code . there whenever the command stops working. That check tells you fast whether PATH still holds after an update or a new Terminal setup.

Laptop screen showing lines of code, the kind of project folder you open with the code command
Opening a project folder from Terminal · Image by markusspiske from Pixabay

If you want to change how the editor looks next, read how to change the color theme in VS Code on Mac. For notebooks and Python work, see VS Code for data scientists on Mac.

VS Code shortcuts for this on Mac

VS Code keyboard shortcuts on Mac
To do thisPress
Open the Command Palette⇧⌘P
Quit Terminal before you retest⌘Q

If it does not work

The Shell Command is not in the Command Palette
Type shell command again and read each label. If only the older Install 'code' command in PATH label shows, AI features may be hidden or your organization may block Copilot CLI installation. Use the manual PATH steps in this guide.
Terminal says command not found: code
Quit Terminal fully and open it again, since a new PATH value needs a new session. If it still fails, add the export line to ~/.zprofile for Zsh or ~/.bash_profile for Bash, then open a new window. The official docs do not list this exact error, so this fix comes from the PATH steps.
code opens an old version or an old workspace
An old code alias from an earlier version may still sit in your shell profile. Open the profile file, delete that alias line, save, then rerun the Shell Command. The FAQ says typing code alone opens your last workspace.
code . opens the wrong folder
The dot means the folder Terminal is in right now. Run pwd to print the current folder, cd to the right one, then run code . again.
You use VS Code Insiders and code does nothing
Insiders builds use the command code-insiders. Run the Shell Command from the Insiders app, then test with code-insiders . in a project folder.
You tried the command in vscode.dev
The web version has no terminal. Open the desktop app from Applications and run the command in Terminal there.

Faster with Lazur

Do it faster: ask Lazur while you are in VS Code

Hold ⌥ ⌘ and say what you want. Lazur sees your VS Code window. Lazur guides you one click at a time and waits for each click.

  • 1

    Hold ⌥⌘ and talk

  • 2

    Lazur guides you one click at a time and waits for each click.

  • 3

    You stay in VS Code. Nothing to copy into a chat window.

Free for 3 days, then $18/month. Download for Mac

You say“Where is the Command Palette, and walk me through the Shell Command?”

Lazur · walks you through itLazur circles the Command Palette, then guides you through the Shell Command one click at a time. It waits for each click, and it does not click for you.

VS Code
ExplorerSearchCommand PaletteClick here firstSource ControlRun

Questions people ask

Why does code not work in Terminal right after I install it?

Quit Terminal fully and open it again. A new PATH value only applies to new sessions. If it still fails, add the export line to ~/.zprofile for Zsh or ~/.bash_profile for Bash, then open a new window and test again.

Is the Shell Command the same thing as the code command?

Not quite. The Shell Command is the VS Code action that sets up the code command for you. You run it once. After that, you type code in Terminal from any folder.

Do I need GitHub Copilot CLI to use the code command?

No. At the Copilot CLI prompt, choose No to install only code. The docs say Copilot CLI installs separately from adding code to PATH, so skipping it does not break the command.

What does code . do exactly?

The dot points to the current folder. VS Code opens that folder as a workspace. Typing code with no folder opens VS Code with your last workspace, according to the VS Code FAQ.

Why does my Command Palette show a different label than this guide?

The older label, Install 'code' command in PATH, shows when AI features are hidden or your organization disables Copilot CLI installation. Both labels set up code. Only the longer one offers the Copilot CLI install.

Can I run the code command from vscode.dev?

No. The web version has no terminal, so there is nowhere to type code. Use the desktop app on your Mac for this command.

Does this work on both Apple silicon and Intel Macs?

The download page lists Universal, Intel chip, and Apple silicon builds, and the setup page says VS Code supports both Intel-based Macs and Macs with Apple silicon. The steps are the same on either chip.

Sources

  1. Installing Visual Studio Code on macOS · Microsoft / Visual Studio Code docs · checked 2026-11-09
  2. Command line interface in VS Code · Microsoft / Visual Studio Code docs · checked 2026-11-09
  3. Visual Studio Code for the Web · Microsoft / Visual Studio Code docs · checked 2026-11-09
  4. VS Code FAQ · Microsoft / Visual Studio Code docs · checked 2026-11-09
  5. Stack Overflow Developer Survey 2025: Technology · Stack Overflow · checked 2026-11-09

Try Lazur free for 3 days

Hold a key and ask. Lazur sees your screen, points at the button and talks you through it, in any Mac app. No credit card.