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.
- Download Visual Studio Code for macOS.
- Double-click on the downloaded archive to expand the contents.
- Drag
Visual Studio Code.app
to theApplications
folder, making it available in theLaunchpad
. - Add VS Code to your Dock by right-clicking on the icon to bring up the context menu and choosing Options, Keep 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.
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.
- Click the Lock icon in the lower left corner so that it Unlocks.
- Provide your password or Touch Id to unlock
- 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. - You will likely see another warning as show in the second image below. Click Open to allow Visual Studio Code to open.
- Click the Unlocked icon in the lower left to re-lock the changes.
- You should now be able to open Visual Studio Code without further interruption.