Set bash_profile to open with Sublime Text 2 by default

bashsublimetextterminal

I'd like Sublime Text 2, not TextEdit, to be the default program to open my bash_profile file when I call open ~/.bash_profile in Terminal. Normally I would just control-click on the file in Finder to set the default program, but given that bash_profile is hidden I'm not sure how to go about this.

Best Answer

You can temporarily show hidden files. In terminal write:

defaults write com.apple.finder AppleShowAllFiles TRUE

and then killall Finder to restart Finder.

Change what you need and then hide hidden files again by changing TRUE to FALSE.

Edit: Making this more explicit. In Finder, locate .bash_profile, open up the properties by right click + "Get Info". Then change the "Open with" to Sublime Text 2. This works, I just tried it.

enter image description here