1

For example, I have Sublime Text that I can open from Spotlight. However, sometimes I'm navigating with the terminal and I want to do sublime source.php, but since I don't have the sublime app accesible from the Terminal, I need to do all the way from opening the app to navigating in finder to the location I already have opened in the terminal. Is there a way to include applications installed in the Apps folder in the terminal PATH?

1

1 Answer 1

3

You can easily add the Applications directory to your PATH but it will not do anything useful as it is a collection of OSX apps which are bundles and can't be run from the command line.

There are several alternatives

  1. Use the open command which will open any OSX app e.g. open -a Sublime\ Text.app source.php This works for all apps
  2. Find the unix executable in the app bundle usually in Contents/MacOS and with a similar name to the app.
  3. Some apps e.g. Sublime provide a specific command line tool and use that. This is what is suggested in Sublime's documentation However I would just create an alias to the full path "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" and use the full path in the EDITOR environment variable
2
  • To your item 2, the executable file for Sublime Text 2.app bundle as defined in its info.plist file is Sublime Text 2, not the python script. There is a binary executable named "Sublime Text 2" in the MacOS folder. Commented Mar 21, 2016 at 15:59
  • 1
    I see you edited item 2 however to your last comment... In "Sublime Text 3" the App bundle is just called "Sublime Text", no number like in the second version, and it's defined executable, per its info.plist file, is too a binary executable of the same name, not the python script that is also in the MacOS folder. Anyway the answer still gets a +1 from me. :) Commented Mar 21, 2016 at 16:37

You must log in to answer this question.

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