Setting Default Browser in Mojave to Something Other than Safari

taugust04
Valued Contributor

Hello all,

There seem to be a number of posts through the years for various versions of OS X and macOS on this topic, but I'm hitting a wall in getting the default browser to be Google Chrome instead of Safari in macOS 10.14.6. So far I've tried a configuration profile for com.apple.launchservices.secure and a login script that overwrites /Users/username/Library/Preferences/com.apple.launchservices/com.apple.launchservices.secure.plist, and I've had no success.

I know there are a couple of third party tools out there that can do this, but I'm hoping to execute this default setting without having to have an end-user acknowledge the change with a pop-up. I'm looking to implement this in our labs and classrooms, where lots of users will be logging in with clean or new profiles on a regular basis.

Can't believe I'm asking about this in 2019. Seems like every year there are more problems that have no easy answer for those of us that manage Macs that aren't assigned to individuals.

Thanks!

4 REPLIES 4

taugust04
Valued Contributor

The lack of response is worrying... I’m guessing that there is no known working way of what I want to do. Rats.

Will try one last ditch effort and see if the a User Template modification will work for this without causing a bunch of errors.

m_donovan
Contributor III

Have you looked at the Chrome Enterprise settings? Here. There is a setting for default browser that might help.

pete_c
Contributor III

856062c03f8846f4a9ac08c47616a698
I haven't found any way to stop the "Do you want to change" dialog; but AppleScript will let you dismiss it.

Download the excellent SwiftDefaultApps and use the swda binary to change the --web protocols to your browser of choice.

Then use osascript to run some AppleScript I shamelessly copied from here:

try
    tell application "System Events"
        tell application process "CoreServicesUIAgent"
            tell window 1
                tell (first button whose name starts with "use")
                    perform action "AXPress"
                end tell
            end tell
        end tell
    end tell
end try

On macOS Mojave, you'll need to have the appropriate PPPC payloads deployed first, otherwise both of these commands will simply spawn more system dialogs requesting permission.

But you end up with a fairly neat solution:

./swda setHandler --web --app /Applications/Google Chrome.app ; osascript /path/to/confirm_system_dialog.scpt

cbrewer
Valued Contributor II

LaunchSetter (@tmhoule) is another good option for URL handler changes.

https://github.com/tmhoule/LaunchSetter