2

Briefly: I would like to open an application for the first time from the command line, and have it act like it was opened in the Finder for the first time.

In more detail:

If you download an application from the internet and open it for the first time from the Finder, you get a dialog box asking:

“MacGuffin.app” is an app downloaded from the Internet. Are you sure you want to open it?

However, if you open the application for the first time from the CLI, it does not give you that dialog -- it just opens the application. This seems to be consistent across a few different ways that I've tried to open the application:

  • open -a MacGuffin
  • osascript -e "tell application \"MacGuffin\" to activate"
  • osascript -e "launch application \"MacGuffin\""

In each case, it just opens the app without verifying. Then, later, if you open the application from the Finder, it goes through the whole verifying step.

What I want to do is to trigger that first-open-and-verify behavior from the command line, so that it does not later re-verify it when it is opened in the Finder.

I'm especially flustered since the man page for open describes its action as "The open command opens a file (or a directory or URL), just as if you had double-clicked the file's icon." Clearly, it does not.

  • 1
    Do you want the dialog to pop up and be clicked or just to do away with that entirely? I'm guessing if we can just suppress entirely the check, you can skip the "I want to trigger" since you only want that if you have to go through that step. – bmike Oct 8 '19 at 1:55
  • 1
    Does osascript -e 'tell application "Finder" to activate application "MacGuffin"' cause the dialog to show? Obviously if you already opened MacGuffin, you'll need to try with another app you've not yet opened. – user3439894 Oct 8 '19 at 2:01
  • 1
    @bmike The important thing is that it does not ask at a later time. This is part of an installation process-- it would be perfectly fine if the user has to click "OK" to open a file downloaded from the internet. – Windell Oskay Oct 8 '19 at 2:04
  • 1
    @user3439894 This works the same as the two other osascript examples that I gave. It opens the application without going through the verification step. If you open it after that (from the finder), you'll get the first-time opening dialog. – Windell Oskay Oct 8 '19 at 2:06
  • 1
    Why not just remove the com.apple.quarantine extended attribute from the file and then the User will not get the ... is an app downloaded from the Internet. Are you sure you want to open it? to begin with? E.g.: xattr -d com.apple.quarantine /path/to/filename – user3439894 Oct 8 '19 at 3:32

You must log in to answer this question.

Browse other questions tagged .