defbro icon indicating copy to clipboard operation
defbro copied to clipboard

How to prevent macOS prompt to change browser?

Open rgl opened this issue 1 year ago • 5 comments

How do we prevent the following macOS prompt to change browser?

image

Are we really doomed to use an applescript like in https://www.felixparadis.com/posts/how-to-set-the-default-browser-from-the-command-line-on-a-mac/#automatically-accept-the-prompt-with-applescript?

rgl avatar Jun 23 '23 21:06 rgl

I thought about this before writing defbro and I decided at that time that it is good to have this security mechanism in place. But there are options: in the app store you can find apps that allow easy switching of the browser. They install themselves as default browser and redirect the clicked URL internally to your preferred browser. I think something like https://sindresorhus.com/velja might be a good choice for this.

jwbargsten avatar Jun 24 '23 06:06 jwbargsten

Does that mean that app store installed applications somehow have more privileges than other applications? If that's not the case, how can installing another app and switching the default browser to it prevent that prompt? I mean, isn't that prompt managed by some macOS "security sub-system"?

PS: FWIW, I'm trying to automate macOS installation using ansible, but this seems to be quite painful, so currently I have to manually grant the required permissions at the macOS desktop UI. I've made this change to my macOS playbook at https://github.com/rgl/my-macos-ansible-playbooks/commit/4932f6d033506689f1045a7e3641378eaf9bb8a3.

rgl avatar Jun 24 '23 07:06 rgl

The difference is that defbro just "switches" the browser, whereas the app I suggested "acts" as browser, takes the url and opens the desired browser, such as chrome. For macos the browser stays the same, because the browser is determined by the app settings.

jwbargsten avatar Jun 24 '23 09:06 jwbargsten

But don't we need to first switch the browser to that application? If so, we are back to square one, and need to manually grant that application the required permission.

rgl avatar Jun 24 '23 09:06 rgl

Indeed. But to configure your macbook you might want to use MDM or edit ~/Library/Preferences/com.apple.LaunchServices.plist directly. This is out of scope for defbro

jwbargsten avatar Jun 24 '23 10:06 jwbargsten