How I Made Cursor My Default Editor on macOS

How I finally made Cursor my default editor on macOS without breaking everything? The journey from VS Code to Cursor, with all the tweaks and terminal tricks that actually worked.

Backup

mkdir -p ~/backup_defaults
defaults read com.apple.LaunchServices/com.apple.launchservices.secure > ~/backup_defaults/launch_services_$(date +%Y%m%d_%H%M%S).plist

for ext in json py js ts tsx md txt sh yml yaml toml c cpp java go rb php html css; do
  current=$(duti -x .$ext 2>/dev/null | head -1)
  [ ! -z "$current" ] && echo ".$ext: $current" >> ~/backup_defaults/duti_backup_$(date +%Y%m%d_%H%M%S).txt
done

Cursor ID

osascript -e 'id of app "Cursor"'
# com.todesktop.230313mzl4w4u92

duti

brew install duti

File Types

CURSOR_ID="com.todesktop.230313mzl4w4u92"

# General
duti -s $CURSOR_ID public.json all
duti -s $CURSOR_ID public.plain-text all
duti -s $CURSOR_ID public.python-script all
duti -s $CURSOR_ID public.shell-script all
duti -s $CURSOR_ID public.source-code all
duti -s $CURSOR_ID public.text all
duti -s $CURSOR_ID public.unix-executable all
duti -s $CURSOR_ID public.data all

# Extensions
for ext in c cpp cs css go java js sass scss less vue cfg json jsx log lua md php pl py rb ts tsx txt conf yaml yml toml xml svg; do
  duti -s $CURSOR_ID .$ext all
done

Shell & Git

echo 'export EDITOR="cursor"' >> ~/.zshrc
echo 'export VISUAL="cursor"' >> ~/.zshrc
git config --global core.editor "cursor --wait"

Verify

duti -x .py
duti -x .js
duti -x .md

Last updated

Was this helpful?