Skip to content

Instantly share code, notes, and snippets.

View Joshua-Hager's full-sized avatar

Joshua Hager Joshua-Hager

View GitHub Profile
@ws
ws / open-code-in-vscode.sh
Created March 11, 2025 21:14
Tell MacOS to use VScode for all code-like file extensions
#!/bin/bash
# This script sets Visual Studio Code as the default application for various code-related file extensions
# using `duti`. If `duti` is not installed, the script prompts the user to install it via Homebrew.
#
# Due to macOS system restrictions, setting .html as the default may fail if Chrome, VS Code, or other editors are open.
# In such cases, the script will notify the user to close those apps and retry.
# Check if duti is installed
if ! command -v duti &> /dev/null; then