0

My config:

  • MacBook pro 2014
  • OSX Yosemite
  • ZShell

I'd like to be able to type:

EdChigliak $: sublime "filename.txt"

and have my file opened in Sublime Text. I suppose I need to add Sublime Text to the $PATH system wide since I do not wish to have to do it in every terminal session. I have been googleing for a while now and just can't crack it...

Do I need to add the whole Applications folder to path? (That is where my Sublime executable resides). Do I add it to .bash_profile file (which is empty now)? to .zshrc?

Many thanks for replies!

1 Answer 1

0

This gist provides you the answer for bash. Instead of ~/.bashrc edit ~/.zshrc.

ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime
grep /usr/local/bin <<< "$PATH" || echo 'export PATH=/usr/local/bin:$PATH' >> .zshrc

The second line uses zsh IO redirection to:

  1. check for /usr/bin/local in your $PATH variable
  2. Add it to ~/.zshrc if it was not found
1
  • Can you add in the relevant parts of the link into your answer? We ask this to help the OP out, so they will not have to search through information that may not pertain to them. This is also to preserve the relevant information in case the hosting site goes down. For more information, see this meta post.
    – Cfinley
    Jun 19, 2015 at 19:27

You must log in to answer this question.

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