Last Updated: July 16, 2018
· jonstaff

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...'

3 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 ·

There are many browsers are available online bust you have to choose one of the best here on our website you will download mozilla firefox browser with more advanced feature and security system that consume less data.

3 months ago ·