I'm on a mac in Terminal.

open -a "Sublime Text 2"

opens Sublmine Text 2, just like I want it to.

I now want to alias this to my .bashrc file, which I have an use for other things like prompt configuration.

alias sublime='open -a Submlime Text 2'

doesn't work. Neither does

alias sublime='open -a "Submlime Text 2"'


source ./.bashrc

doesn't help. Each time I am told

≈:≈ sublime 
Unable to find application named 'Submlime Text 2'

I'm doing this wrong and I know it must be a simple answer...

  • You've misspelled Sublime Text? – DisplayName Dec 9 '15 at 16:13

Either of these should work:

alias sublime='open -a "Sublime Text 2"'
alias sublime='open -a Sublime\ Text\ 2'
|improve this answer|||||
  • Backslashes will not work here, as you are already escaping the spaces with '. – DisplayName Dec 9 '15 at 16:14
  • @DisplayName, actually it will :) – sdayal Dec 9 '15 at 16:26
  • No. It will look for an application that is called literally Sublime\ Text\ 2. – DisplayName Dec 9 '15 at 16:27
  • @DisplayName, you could try it in a bash shell yourself. – sdayal Dec 9 '15 at 16:29
  • Sorry, I misread. I thought there was a ' before the S. – DisplayName Dec 9 '15 at 16:32

If you follow Sublime Text's recommended procedure of creating a symbolic link to their command line tool you will be able to open files, use as an $EDITOR with git, subversion, etc… It gives much more power and flexibility over creating an alias.

In a nutshell you can use this command to create an symbolic link to the tool:

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

and then use the tool from the command line.

subl --new-window ~/.profile

will open your bash profile in a new window in "Sublime Text 2". You can also use the subl command without any arguments to open the app.

To get this to work you may need to add ~/bin to your $PATH variable in your ~/.profile.

export PATH=$PATH:$HOME/bin

See also Sublime Text's instructions.

|improve this answer|||||

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .