jefqyg
Last Updated: February 25, 2016
·
24.27K
· jonstaff
2013 06 10 14.10.34

Setting Sublime Text as the Default Editor OSX

Let's face it - TextEdit is mediocre at best. Sublime Text is leaps and bounds ahead of most text editors out there (if you didn't know that already, it's definitely work checking out).

So how can we swap TextEdit for Sublime? Simple.

Just enter the following into Terminal (Note: a restart is required for these changes to take effect):

defaults write com.apple.LaunchServices LSHandlers -array-add {LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.2;}

Any plain text files should now open directly in Sublime Text and you'll be able to use the command line open -t <filename> to open files with Sublime.

Alternatively, you could find a plain text file in Finder and click 'Get Info'. Under 'Opens with:', select Sublime Text and click 'Change All...'

Say Thanks
Respond

2 Responses
Add your response

13198
C2b713e1768bad21524727c4e3accbe4

For Sublime Text 3:
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}'

source:
https://gist.github.com/wishfoundry/7036457

over 1 year ago ·
16440
29ce88deb67c3c3763674d428362d750

This is great, allows you to specify the default for the content type, rather than the file extension.

But the snippet given above didn't work for me, I had to quote the content like in k-funk's example. ie:

defaults write com.apple.LaunchServices LSHandlers -array-add "{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.2;}"
over 1 year ago ·