Can somebody explain how to make vscode the default editor on osx?

Xcode is the current default editor when opening files and I'd like to switch it to vscode


The editor is associated with the file extension on macOS.

When you select one of your code files press Command+I to open the inspector (or choose "Get Info" from either the "File"- or contextual menu) and you will find a section called "Open With:". When expanded you should see a drop-down menu and a "Change All…" button.

Pick the application you would like to open this file from the drop-down menu and then click on "Change All…". A dialog will ask you to confirm that your chosen editor shall be used for all files that have the same extension as the current one.

Do this for all file-types where you would like to change the associated editor.

I hope this helps.


I used a combination of Thomas Krajacic's answer above and a tool called duti - making the vscode the default editor for all these languages known to GitHub languages.yml

brew install duti python-yq
curl "https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml" \
  | yq -r "to_entries | (map(.value.extensions) | flatten) - [null] | unique | .[]" \
  | xargs -L 1 -I "{}" duti -s com.microsoft.VSCode {} all

Also linking to another thread discussing the same and this site.

FYI I am running Monterey 12 on Mac M1