0

I am new to macOS. Also, I am using Apple Macbook Air M1 Monterey 12.5.

Before buying this Mac, I was using Linux (NixOS and Ubuntu) for several years. In Linux, while using bash, I was able to open firefox just by doing:

$ firefox

macOS also comes from the Unix family and I am using bash on both OS. Thus, I do not understand why I can't do:

Pedros-MacBook-Air:~ pedro$ firefox
-bash: firefox: command not found

To open firefox from terminal, I need to do the command below to open firefox on Mac:

Pedros-MacBook-Air:~ pedro$ open -a firefox

To make things even more obscure, to open emacs I can simply do the following and it works:

Pedros-MacBook-Air:~ pedro$ emacs

Why is it so? Why I can't open firefox in bash's macOS as I used to do in Linux distros' bash? And why can I open emacs this way?

2

1 Answer 1

2

You can run MacOS bundled programs like Firefox from the terminal using open. Or you can run the executable within the program bundle by executing it from its path: /Application/FireFox.app/Contents/MacOS/FireFox.

Standard I/O apps in the binaries path of your shell can be executed by the name of their executable.

Or you actually execute a shell script which opens the binary - bundled app or its executable. If you e.g. installed some program you downloaded, what exactly is done when you execute a command in your shell depends on the programm.

Similar you can wrap shell scripts or standard i/O programs into a bundle using e.g. Platypus.

Self-contained bundled programs facilitate their installation and deinstallation by allowing to do this using drag&drop in the Finder.

6
  • just saw that this was already answered previously here. Aug 3 at 16:31
  • @WGroleau, what about emacs? Shouldn't it be considered a GUI? Aug 3 at 17:08
  • this should be a new question. you should provide in detail what exactly you want to use Emacs for. Aug 3 at 17:19
  • 1
    If /Application/FireFox.app/Contents/MacOS was in your $path, then firefox would work. But almost any app that has a GUI is in a *.app wrapper like the one mentioned here.
    – WGroleau
    Aug 3 at 17:48
  • 1
    @WGroleau Emacs can either run in the terminal or fully graphical. The one provided with macOS is terminal only and not a bundled app
    – mmmmmm
    Aug 3 at 19:36

You must log in to answer this question.

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