Welcome to DU! The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards. Join the community: Create a free account Support DU (and get rid of ads!): Become a Star Member Latest Breaking News Editorials & Other Articles General Discussion The DU Lounge All Forums Issue Forums Culture Forums Alliance Forums Region Forums Support Forums Help & Search

CloudWatcher

(1,947 posts)
6. You can use the "open" command, but beware of some magic
Tue Jun 28, 2022, 12:26 AM
Jun 2022

This is likely more than you wanted to know, but ... you asked ... and for anyone else trying to use open ....

Big Sur has some magic under the hood for "merging" directories and while it's usually something that can be ignored, when you use "open" it becomes very visible.

Let's take a simple example: launching the Mail application.

In older Mac OS's you can do this in a Terminal shell window:

open /Applications/Mail.app

And it will launch the Mail application. But under Big Sur this same command fails. It's like Mail.app doesn't exist. You'll actually get the error:

The file /Applications/Mail.app does not exist.

But ... but ... when you examine /Applications with the Finder, you see Mail.app sitting right there.

So what's going on?

Apple has moved their apps and are using some slight-of-hand to mostly make it look like it did before.

The new layout is like this:

Customer installed applications go in /Applications/
Customer installed utilities go in /Applications/Utilities/
MacOS supplied applications go in /System/Applications/
MacOS supplied utilities go in /System/Applications/Utilities/

Looking at /Applications with the Finder shows the combined contents of /Applications and /System/Applications. And looking at /Applications/Utilities also shows the merged contents.

So ... wtf? Why did they do this? Because now the apps in /System/Applications/ are much more protected from malware. All the files under /System/ are almost impossible to modify outside of actual Apple-supplied updates.

And it "just works" if you use the normal user-interface to launch applications.

But if you use the "open" command in Terminal you'll need to give it the right path (when using paths).

So on Big Sur, the correct command to launch Mail is:

open /System/Applications/Mail.app

For a fun time, you can use the "ls" command to see where apps really live:

ls /Applications
ls /System/Applications

You'll see MacOS built-in apps in /System and customer (and Apple Store) supplied apps in /Applications. Note that "ls" is "el" and "s" ... not "one" and "s".

Pro tip #1: use the "tab" key for filename completion. What I type is:

ls /AppTAB

where TAB is just the tab key. And the shell will complete the path for me and prints out:

ls /Applications/

it will beep at you if what you've supplied (before hitting TAB) doesn't exist or is not unique.

Pro tip #2: you'll need quotes to enclose special characters in paths, especially spaces. E.g.

open "/Applications/Google Chrome.app"

Ok, enough for now. Hope this helps someone ... someday

Recommendations

0 members have recommended this reply (displayed in chronological order):

Latest Discussions»Culture Forums»Apple Users»anyone know of a good sim...»Reply #6