[ACCEPTED]-Set TextMate as the default text editor on Mac OS X-textmate

Accepted answer
Score: 93

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

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

Score: 43

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

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

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

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

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

$ open ~/.bashrc
Score: 2

Have you modified your shell PATH environment 5 variable to include ~/bin? That directory is 4 usually not included in PATH by default 3 on OS X. It might be simpler to create 2 the symlink in /usr/local/bin which is usually included 1 in PATH. Try:

echo $PATH
Score: 2

This worked for me on OS X v10.11 (El 1 Capitan):

defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add \
Score: 2

For TextMate 2:

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

And you need to restart after 1 that.

Score: 1

To change the default text editor across 11 the board, use the aforementioned method 10 (i.e., "Get Info" → "Open with:" → (editor of choice) → "Change All") on 9 .txt files. Then it will be used as the default editor 8 for any text-based file that doesn't yet 7 have an application preference for its extension.

For 6 instance, if you use the terminal, the command 5 open -t will use your preferred text editor, which 4 is whatever application is associated with 3 .txt files. By default this is (you guessed 2 it) TextEdit, unless you explicitly specify 1 otherwise.

Score: 0

I found Replace Text Edit as the default text editor on apple.stackexchange which works 8 really well.

For developer-type files like 7 .gitignore, use the last option provided:

duti -s com.macromates.TextMate public.data all

Substitute 6 your editor's CFBundleIdentifier as needed. To 5 find it, locate the application file, right-click 4 and choose Show Package Contents, then open 3 Info.plist in the Contents folder. CFBundleIdentifier 2 should be near the top...

This work on Catalina. I'll 1 update my answer if/when I update my OS.

More Related questions