Skip to content

Instantly share code, notes, and snippets.

@rossjs
Last active January 4, 2026 15:06
Show Gist options
  • Select an option

  • Save rossjs/b7ab489bcb30bac638317e2aeb28cb20 to your computer and use it in GitHub Desktop.

Select an option

Save rossjs/b7ab489bcb30bac638317e2aeb28cb20 to your computer and use it in GitHub Desktop.
MacOS Setup: Open Folders in VS Code

Open Folders in VS Code

Option 1: Launch from the Terminal using code .

This is the official method from Microsoft and allows you to open a folder in VS Code directly from your terminal.

  1. Launch VS Code.

  2. Open the Command Palette using the shortcut Cmd + Shift + P.

  3. Type shell command into the search bar.

  4. Select and run the command:
    Shell Command: Install 'code' command in PATH

  5. Restart your terminal application(s) for the change to take effect.

  6. Once installed, you can navigate to any project folder in your terminal and type:

    code .

    (Don’t forget the dot) to open that folder in Visual Studio Code.


Option 2: Add a Right-Click (Context Menu) Option

For a direct right-click menu option in Finder, you can create an Automator Quick Action.

  1. Open Automator (found in your Applications folder or via Spotlight search).

  2. Select File > New, and choose Quick Action as the document type.

  3. At the top of the workflow pane:

    • Set Workflow receives current to folders in any application
      (or just Finder for a more specific setup).
  4. In the actions library on the left, search for Run Shell Script and drag it into the main workflow area.

  5. In the Run Shell Script action:

    • Set Shell to /bin/bash or /bin/zsh.
    • Set Pass input to as arguments.
  6. Replace the default script with the following code:

    for f in "$@"
    do
        open -a "Visual Studio Code" "$f"
    done
  7. Save your Quick Action with a descriptive name, such as Open in Code.

  8. Now, you can right-click on any folder in Finder, select Quick Actions, and choose Open in Code to open the folder in Visual Studio Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment