I want to open files without file name extension, including .dotsystemfiles (e.g. .htaccess or .vimrc) with a different editor than TextEdit. Doing the regular Change All... in the Get Info panel won't do the trick as it gives the following error:

alt text

link|improve this question
Jason, I edited your question for improved clarity. Please revert changes you think are bad. – Daniel Beck Jan 11 '11 at 18:10
Thank you very much Daniel, that's wonderful. – jasonkuhrt Jan 11 '11 at 19:37
feedback

1 Answer

up vote 10 down vote accepted

You need to change the editor for the text/plain mime type or public.plain-text UTI. The regular Get Info dialog changes the association for the file name extension, which these files don't have.


Get RCDefaultApp and install it.

Open System Preferences » Default Apps » Apps. Select your desired default editor, and look for either of the above in the application's list of supported types.

alt text alt text alt text

Select the entry, and click Set as Default. You're done. Both opening from Finder and the command-line open will open your new default editor.


This also changes all .txt files and the like. I don't think this can be prevented, since OS X thinks both these and extension-less files are public.plain-text/text/plain.


To do this without RCDefaultApp, edit Edit ~/Library/Preferences/com.apple.LaunchServices.plist.

Add an entry under LSHandlers, containing the UTI (key LSHandlerContentType, e.g. public.plain-text) and application bundle identifier (LSHandlerRoleAll, e.g. com.macromates.textmate).

It looks like this in Property List Editor:

alt text alt text

link|improve this answer
1  
Or choose the Mime types tab and choose what app text/plain is opened by (this allows Aquamacs.app to be used which does not have the Mime types shown in its list – Mark Jan 11 '11 at 18:18
This worked for me. Thanks a lot Daniel. A couple things to add: I needed to log out of the OS and then back in. Also, curiously, .DS_STORE files still open in TextEdit by default, but all other .dotsystemfiles are now opening in my desired editor. – jasonkuhrt Jan 11 '11 at 19:57
Is there a way to do this with defaults write instead of downloading third party software? – MattDiPasquale Jan 20 '11 at 5:29
@Matt See my edited post. – Daniel Beck Jan 20 '11 at 6:14
@Danel Beck, awesome, thanks! :) – MattDiPasquale Jan 21 '11 at 1:17
show 3 more comments
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.