Created
July 15, 2026 06:09
-
-
Save kowyo/a6de8efb670b091f62cd1d62ce8777e4 to your computer and use it in GitHub Desktop.
Switch common macOS file associations to Visual Studio Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| if ! command -v duti >/dev/null 2>&1; then | |
| printf '%s\n' 'duti is required. Install it with: brew install duti' >&2 | |
| exit 1 | |
| fi | |
| bundle_id='com.microsoft.VSCode' | |
| extensions=( | |
| js jsx ts tsx mjs cjs json json5 jsonc html htm css scss sass less | |
| vue svelte astro md mdx markdown yaml yml xml toml ini conf config env | |
| sh bash zsh fish ps1 bat cmd py pyw pyx rb php java kt kts go rs swift | |
| c cc cpp cxx h hpp cs fs fsx sql graphql gql lua dart r R jl ex exs erl | |
| hrldg clj cljs groovy gradle dockerfile makefile tf tfvars proto csv tsv | |
| log txt code-workspace code-profile vscode | |
| ) | |
| for extension in "${extensions[@]}"; do | |
| duti -s "$bundle_id" "$extension" all | |
| done | |
| duti -s "$bundle_id" vscode all | |
| duti -s "$bundle_id" vscode-insiders all | |
| printf '%s\n' 'Default code and project file associations now use Visual Studio Code.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment