Today I ran into the issue of trying to install a newer version of Visual Studio Code on my Mac.  macOS Catalina has a number of new security features and by default it does not recognize Visual Studio Code.

Installing Visual Studio Code

Before we get into how to fix the installation of Visual Studio Code, let’s go ahead and install it you haven’t already.  There are two basic ways.

Homebrew

If you don’t have Homebrew installed, you will first need to follow the install instructions on the Homebrew homepage.  With Homebrew installed, complete the following steps:

$ brew update
$ brew cask install visual-studio-code
$ code

NOTE:  If ‘code’ doesn’t work, try ‘/usr/local/bin/code’ .

Microsoft Instructions

Follow the instructions here:  https://code.visualstudio.com/docs/setup/mac

A summary of the steps is included here for reference.

  1. Download Visual Studio Code for macOS.
  2. Double-click on the downloaded archive to expand the contents.
  3. Drag Visual Studio Code.app to the Applications folder, making it available in the Launchpad.
  4. Add VS Code to your Dock by right-clicking on the icon to bring up the context menu and choosing OptionsKeep in Dock

Running Visual Studio Code

When you try to run Visual Studio Code, you will likely seen an error stating “Visual Studio Code” can’t be opened because Apple cannot check it for malicious software.

Security & Privacy Settings for Visual Studio Code
Security & Privacy

After you see this error, go to System Preferences -> Security & Privacy.  Click on the General tab and you should see a screen similar to the following.  Complete these steps.

  1. Click the Lock icon in the lower left corner so that it Unlocks.
  2. Provide your password or Touch Id to unlock
  3. Click on Open Anyway button next to the text that states “Visual Studio Code” was blocked from use because it is not from an identified developer.
  4. You will likely see another warning as show in the second image below.  Click Open to allow Visual Studio Code to open.
  5. Click the Unlocked icon in the lower left to re-lock the changes.
  6. You should now be able to open Visual Studio Code without further interruption.

    Visual Studio Code Can't Be Opened Image
    Visual Studio Code