Skip to content

Instantly share code, notes, and snippets.

@wishfoundry
Last active April 1, 2022 05:18
Show Gist options
  • Star 48 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save wishfoundry/7036457 to your computer and use it in GitHub Desktop.
Save wishfoundry/7036457 to your computer and use it in GitHub Desktop.
Set OSX default text editor to sublime text 3 instead of TextEdit
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}'
@rosedomini
Copy link

Thanks! May I ask how did you find that "com.sublimetext.3" is the package name for the Sublime Text app? I tried googling for it but...

@chbrown
Copy link

chbrown commented Oct 13, 2014

@rosedomini: cat "/Applications/Sublime Text.app/Contents/Info.plist" and look at the value of CFBundleIdentifier

@shawnzhsh
Copy link

can I extend to specific extension file type, such as *.log, *.cfg etc ?

thanks.

@kennedy
Copy link

kennedy commented Aug 27, 2017

Im getting this error on macOS Sierra

defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}'
2017-08-26 19:58:45.582 defaults[24068:864501] Value for key LSHandlers is not an array; cannot append.  Leaving defaults unchanged.

Does anyone have any insight?

@mitinarseny
Copy link

Im getting this error on macOS Sierra

defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}'
2017-08-26 19:58:45.582 defaults[24068:864501] Value for key LSHandlers is not an array; cannot append.  Leaving defaults unchanged.

Does anyone have any insight?

Hello!
I have the same problem. How did you solve it?

@tobiashochguertel
Copy link

Restart Finder after the above command via: COMMAND + ALT + ESC, scroll down the list and select "Finder" and press "Relaunch".

Works fine here with MacOS Catalina Version 10.15.4 (19E266).

@dr1793
Copy link

dr1793 commented Sep 3, 2020

No errors, but no changes either on Catalina 10.15.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment