How to get rid of "application downloaded from the internet" message when installing homebrew casks?

I used homebrew cask to install many applications for quite a while now. But recently macOS keeps asking me to first confirm the "application downloaded from the internet" question that is usually only displayed for apps that are run for the first time.

enter image description here

What happened and how can I get rid of this?

Update

I use an admin account to install apps (brew cask install calibre), but I basically use a non-admin account all the time. I can get rid of the message by logging into the admin account and launching the app once and then the message disappears also for the user account.


Solution 1:

Wohoo! I just realized that there is apparently now a built-in solution to the problem! Homebrew offers a --no-quarantine flag. That means one can now install casks without the annoying message, by using

brew install --no-quarantine calibre

or

brew reinstall --no-quarantine calibre

Update: There is currently a bug in Homebrew that prevents the latter command (reinstall) from working.

To make this a default option, add this to your profile:

echo 'export HOMEBREW_CASK_OPTS=--no-quarantine' >> ~/.profile

Solution 2:

As you mentioned in your update, you can open the application as an admin user. A more direct way is to run this command as an admin:

xattr -r -d com.apple.quarantine /Applications/Calibre.app

Solution 3:

More of a workaround than a solution: Launching the App from an account with admin privileges once, makes the message disappear also for the non-admin account. Not sure if this is a bug or a feature... In the past it used to work like that also from non-admin accounts.