Last Updated: February 25, 2016
· 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 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

2 Responses
Add your response


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


over 1 year ago ·

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 LSHandlers -array-add "{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.2;}"
over 1 year ago ·