Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set TextMate as the default text editor on Mac OS X

How can I set TextMate as default text editor on Mac OS X?

I've tried it with

ln -s /Applications/TextMate.app/Contents/Resources/mate ~/bin/mate export EDITOR='mate -w' 

but that doesn't work.

like image 241
Ben Avatar asked Feb 21 '12 00:02

Ben


People also ask

What is the default text editor in macOS called?

Your Mac comes with a text editor: TextEdit. You'll find it in the Applications folder. This app allows you to write in two ways: in RTF (rich text format), which allows you to apply standard formatting, and even add images to files, and plain text.


2 Answers

Just right (or control) click a file of the type you want to change and:

"Get Info" -> "Open with:" -> (Select TextMate) -> "Change All"

like image 184
Timeout Avatar answered Sep 19 '22 15:09

Timeout


The method through Finder is not practical. If you're a developer, your files likely include .profile, .gitconfig, .bashrc, .bash_profile, .htdocs, etc.

The best way to do this is in Bash (for Sublime Text 3):

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

For other text editors, I assume you can replace 'com.sublimetext.3' with the proper string. You could probably Google for your text editor's name + "LSHandlerContentType=public.plain-text" to figure out what your app's string would be.

For me, this changed the defaults for both Finder, and

$ open ~/.bashrc 
like image 42
KFunk Avatar answered Sep 20 '22 15:09

KFunk