How does the 'Applications' folder get on the path?

For example, I installed Chrome browser into the Applications folder on my Mac and I can type chrome at a bash shell prompt to start it. Now, if I type which chrome, I get nothing, and therefore it doesn't reveal itself: how it got on the path.

BUT, on the other hand, if I move Chrome to my own custom /opt/local/applications folder, running with chrome no longer works and neither will it work if I add this to the path: /opt/local/applications/Google Chrome.app/Contents/MacOS . I am trying to understand this so I can get Chrome working from the command line, when installed into a custom location.

  • 2
    What does type chrome return? – nohillside Apr 21 '16 at 18:34
  • If, in a Terminal, I type chrome, I get -bash: chrome: command not found. If I type open -a chrome, I get Unable to find application named 'chrome'. If I type open -a 'google chrome', Google Chrome opens as expected. What I've described is the default behavior and if doing only chrome in a Terminal opened Google Chrome for you, then you either have an Alias assigned or a Script that executes the appropriate command line. BTW open -a $application_name should open the target .app bundle whether or not it's in the $PATH`. – user3439894 Apr 21 '16 at 19:08
  • @djangofan Here $ chrome results in zsh: command not found: chrome. The command output of echo $PATH might give you a clue where the open -a alias is located. – Pro Backup Apr 21 '16 at 21:16

You must log in to answer this question.

Browse other questions tagged .