Setting Visual Studio Code as default text editor on macOS

Mar 23, 2021

Visual Studio Code is quite capable has become my editor of choice on macOS. Here is how to set it as the default text editor instead of Text Edit.

Install duti.

1
brew install duti

Set Visual Studio Code as the default editor for all text files and public files by running the below commands using duti.

1
2
3
4
5
# Mark vscode as default editor for all text files
duti -s com.microsoft.VSCode public.plain-text all

# Some files without extensions are considered public.data and not public.text. Set those to open in vscode as well
duti -s com.microsoft.VSCode public.data all

The changes should take effect right away and no reboot or relaunch of Finder should be needed.

How TosmacOSVisual Studio Codevscode

Setting up Keras Tensorflow2 on M1 Mac

macOS and Active Directory Passwords