I am trying to add Firefox to my PATH like in this tutorial. I have Firefox in the Applications folder of my GUI on my mac book air. I am familiar with adding locations to my path. But I don't know how to find the firefox executable on my machine. Where does the applications folder go to look for the Firefox executable?


4 Answers 4


The binary would be inside the application bundle. For example,

$ file /Applications/Firefox.app/Contents/MacOS/firefox-bin 
/Applications/Firefox.app/Contents/MacOS/firefox-bin: Mach-O universal binary with 2 architectures
/Applications/Firefox.app/Contents/MacOS/firefox-bin (for architecture x86_64):Mach-O 64-bit executable x86_64
/Applications/Firefox.app/Contents/MacOS/firefox-bin (for architecture i386): Mach-O executable i386

You could launch Firefox by running /Applications/Firefox.app/Contents/MacOS/firefox, and you could put /Applications/Firefox.app/Contents/MacOS in your $PATH to help you save some typing. However, the Mac OS X way to launch an application from the command line would be

open -a Firefox

open(1) is a command-line tool to interact with Launch Services.


Using type

You can use the command type to locate where an executable is coming from on the filesystem.


$ type -a firefox
firefox is /usr/bin/firefox

Using locate

If firefox is not already on the PATH then interrogating the locate database using the locate command might be your only other option. However recently installed items may not show up there until the updatedb command has had a chance to index these newly added files to the filesystem.


$ locate firefox | grep 'firefox$'


If you don't have access to the locate facility on OSX you can try using mdfind as well to locate occurrences of firefox.

  • I am getting me$ type -a Firefox -bash: type: Firefox: not found
    – bernie2436
    Commented Nov 8, 2013 at 19:53
  • 1
    @akh2103 - Try lowercase firefox.
    – slm
    Commented Nov 8, 2013 at 19:59
  • 1
    This assumes that firefox can already be found from PATH, which is what the OP is trying to accomplish.
    – Joseph R.
    Commented Nov 8, 2013 at 20:29
  • Not really applicable to osx. Commented Nov 8, 2013 at 20:34
  • @200_success In what way? type is a Bash builtin; OS X, as far as I know, uses Bash as the default shell.
    – Joseph R.
    Commented Nov 8, 2013 at 20:40

You can do it like this :

$ readlink -f $(type -p firefox)

if firefox is not in the PATH :

$ find / -name firefox 2>/dev/null
  • Boy, will that take time!
    – Joseph R.
    Commented Nov 8, 2013 at 20:34
  • Depends of your hardware (for some people, just =~ 3 seconds), but it works. updatedb takes time too =) Commented Nov 8, 2013 at 20:35
  • True, but not nearly as much as crawling your whole filesystem. updatedb is usually run regularly by cron to keep the database up-to-date so a new update shouldn't take that long. As for the find approach, imagine the worst case scenario where the firefox executable is stored under /ze_tools!
    – Joseph R.
    Commented Nov 8, 2013 at 20:37
  • 1
    @GillesQuenot I joined this community just to upvote your response. Firefox was not in my path and I couldn't find the proper directory I needed for my selenium python script. I thank you for the second line of code you posted- it really helped!
    – daOnlyBG
    Commented Nov 22, 2016 at 4:07

Not quite the same problem, but since I found this answer when googling, I'm providing my solution here too.

I'm trying to find the firefox executable to execute it from scripts like cucumber / selenium tests. Here's what I do:

Find it with Spotlight

firefox_paths = %x[mdfind "kMDItemFSName = Firefox.app"]
firefox_path = firefox_paths.split('\n').first.chomp
firefox_executable_path = File.join(firefox_path, '/Contents/MacOS/firefox')


Another way would be to dump launch services database and grep it out there

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump \
  | grep -n7 org.mozilla.firefox \
  | grep path: \
  | awk '{ print($3) }'

You must log in to answer this question.

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