When I try to open 'chrome' or 'safari' in terminal,

$ safari
-bash: safari: command not found
$ open safari
The file Desktop/safari does not exist.
$ chrome
-bash: chrome: command not found

How to open them in right methods.

4 Answers 4


Its trying to open the files from the Desktop folder. Safari is in the Applications folder. From the top level / you should type open Applications/safari This works fine for me. cd up to / and do ls. The Application folder should show up. If not you are in the wrong directory.

  • 3
    All you need to do in Terminal, no mater what the PWD, is use open -a Safari or open -a Google\ Chrome and if wanted, add the URL afterwards if you want to open the Browser to the given URL. You do not need the type the pathname or the .app extension. Commented Nov 16, 2017 at 0:24
  • Does not work in Monterey (12.5.1) The file /Applications/Safari.app/Contents/MacOS/Applications/safari does not exist.
    – Michal S
    Commented Sep 13, 2022 at 8:07

All you need to do in Terminal, no matter what directory you're in, is use

open -a Safari
open -a Google\ Chrome

and optionally, add the URL afterwards if you want to open the Browser to the given URL

open -a Safari http://apple.com/
  • 1
    This does not work for me in Monterey. open -a Safari http://apple.com/ opens apple.com in both Safari AND Chrome. Chrome is my default browser. open -a Safari\ Technology\ Preview http://apple.com/ does work and only opens the site in Safari Technology Preview. open -a Firefox http://www.google.com/dogs opens Firefox if it not already opened, but does not go to the site on the command line.
    – dgrogan
    Commented Mar 25, 2023 at 0:40

There are several ways you could do it. But first, if Safari is your default browser, then you can just use this to open the URL:
open <url> => open http://www.google.com (Remember to specify the protocol!) and this will open the URL in Safari (default browser)

Otherwise you can be more specific like:

/usr/bin/open https://google.com/

And to open a sepecific browser, you can do

/usr/bin/open -a Safari https://google.com/
/usr/bin/open -a Firefox https://google.com/
/usr/bin/open -a Chrome https://google.com/
  • /usr/bin is in the typical search path, there is hardly ever a need to specific this.
    – nohillside
    Commented Dec 30, 2020 at 8:50
  • I sometimes faced issues when trying to open a web browser with open when I was in some directory other than root and adding the exact path worked every time for me. I even added a small function in my .zshrc file to open a URL in all browsers for testing a URL. Commented Dec 30, 2020 at 10:22

as of os 10.11.6, you may use:

open http://github.com to open in default browser.

  • The answer is not perfect, does not include safari and chrome, but the question was not specific to use and. This is the easiest way, worth knowing. Negative score is wrong.
    – Michal S
    Commented Sep 13, 2022 at 8:05

You must log in to answer this question.

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