Skip to content

Instantly share code, notes, and snippets.

@wishfoundry
Last active April 1, 2022 05:18
Show Gist options
  • Select an option

  • Save wishfoundry/7036457 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

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

chbrown commented Oct 13, 2014

Copy link
Copy Markdown

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

@shawnzhsh

Copy link
Copy Markdown

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

thanks.

@kennedy

kennedy commented Aug 27, 2017

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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

dr1793 commented Sep 3, 2020

Copy link
Copy Markdown

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