Cannot assign 'Open With' to a specific application using Mountain Lion

I am using Mountain Lion 10.8.2 and Coda 2.0.4.

I want all my .js files to open with Coda (currently js files are assigned to Safari).

When I do a 'Get Info' and change the 'Open with' application I try to select Coda 2 but it immediately bounces back to Safari.

If I choose any other application, like Firefox, XCode, etc it takes it. It only seems to hate Coda 2.

Any idea what's the issue?


Solution 1:

Have you tried rebuilding the Launch Services database by running /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -seed?

If that doesn't work, you could also try defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=com.netscape.javascript-source;LSHandlerRoleAll=com.panic.Coda;}'. Applying the changes requires restarting (logging out and back in isn't enough).