Making Chrome the Default Browser in 10.15

cjkelley
New Contributor

Has anyone had any luck finding a way to make Chrome the default browser automatically for all users? We're using Catalina (10.15). The closest thing I have been able to do is just block Safari notifications asking to be the default browser once the user switched to Chrome. Thanks!

16 REPLIES 16

easyedc
Valued Contributor II

Setting the default browser lives in the user space and Apple took control over that away years ago.  'Cause Apple.  It's not impossible, but it's not easy.  Some folks have had success in the past trying to use tools like launchsetter or duti but I'll be honest, that may not be easy. Check out the blog post here - https://technology.siprep.org/script-making-chrome-the-default-browser-on-macos/ - that might get you going in the right direction. 

 

Do you have Apple Enterprise support? Ask them for an official "Apple" way and when they come back and say it can't be managed, give them proper feedback. Also - check out this post here - https://community.jamf.com/t5/jamf-pro/setting-default-browser-in-mojave-to-something-other-than-saf... - a few folks have posted a few different options, but they are a few years old, no guarantee they still work. 

targendaz
New Contributor II

I built this a while back to do exactly what you're trying to do: https://github.com/targendaz2/Mac-Set-Default-Apps

Hi @targendaz Thanks for the info, It helps a lot!
can you please explain a little more about the flow of distribution through Jamf (as a script),
About the msda set [-h] [-feu] [-fut] [-e EXTENSION ROLE] [-p PROTOCOL] [-u UTI ROLE] app_id
I try to set Google Chrome as the default web browser.
Thanks

targendaz
New Contributor II

Absolutely! The app’s readme covers using it as a Jamf script, but if you let me know where you’re running into trouble, I can point you in the right direction.

We totally love your Mac Set Defaults App script. Do you have any plans to make it compatible with Monterey 12.3 that doesn't include Python?

I would also love to see the Mac Set Defaults App script compatible with Monterey 12.3 as well. We use it for setting Chrome and Adobe Reader as their respective defaults during pre-stage enrollment.

Blaban278
New Contributor

I created new policy, added the script (Set the JAMF variable to True in the User-Editable Settings section)
and the command -h --version Parameter 4 text in the policy.
About the Set command, Where it should be done? 

msda set com.google.chrome -p http -p https -u public.url all -u public.html viewer -u public.xhtml all -fut
Thanks

targendaz
New Contributor II

Parameter 4 of the script in the policy would be:

set com.google.chrome -p http -p https -u public.url all -u public.html viewer -u public.xhtml all -fut

Optionally, you can add -feu to that if you want the default browser to be Chrome for existing users as well.

Blaban278
New Contributor

Thank you very much I will try this out!

Blaban278
New Contributor

@targendaz I get this error - Service exited due to SIGKILL | sent by mds
do you familiar with it?
 

targendaz
New Contributor II

@Blaban278 I’d need more context to know what happened. Why don’t you open an issue on the app’s GitHub page. I’ll follow up there rather than monopolizing this thread.

Nick1403
New Contributor III

thank you for sharing, @targendaz!
That's what I've been looking for. 
it works wonderfully on macos 11.5.1 & M1 and 11.4.0 & Intel.

I put the script in the same policy as the Google Chrome Self Service Installation.
Parameter 4 is: set com.google.chrome -p http -p https -p mailto -u public.url all -u public.html viewer -u public.xhtml all -fut

Thanks! This is what I needed to get mine working

marcushe
New Contributor II

Hello @targendaz! Thank you so much for this script!

We are using Mosyle MDM instead of JAMF - Mosyle does not have a parameter function. How can we embed the Chrome parameter into the script so it acts as a standalone script for setting Chrome as default? Thank you much!

marcushe
New Contributor II

Hi we solved this. We realized we just needed to install the .pkg for MSDA and then run the "msda set" commands to set the defaults. We added postinstall script to our .pkg to facilitate installing and setting defaults in one package.

However in Mosyle - the install PKG feature only works for PKG's that have a .app file in them (the msda .pkg only has a .py python text file)

So we had to install the .pkg via a custom command in Mosyle using curl to download the .pkg from the Mosyle CDN. We also had to enable variables for the custom command profile and add the variable for the .pkg file in the Mosyle CDN - as Mosyle download URLs expire after 24 hours unless their file variable is used. Here is our command:

#please visit https://github.com/targendaz2/Mac-Set-Default-Apps for updated packages and manually upload future updates to Mosyle CDN

#changes into the temporary folder
cd /tmp 

#downloads package from Mosyle CDN using their specific variable for the file
curl -L --silent -o /tmp/MacSetDefaultAppsv1.3.1.pkg "%MosyleCDNFile:b1ac25f7-4744-417d-a787-11d572063438%"

#installs the package
installer -allowUntrusted -pkg /tmp/MacSetDefaultAppsv1.3.1.pkg -target /

#removes the package after installation
rm -rf MacSetDefaultAppsv1.3.1.pkg

#Set default apps after install
/usr/local/bin/msda set com.google.chrome -p http -p https -p mailto -u public.url all -u public.html viewer -u public.xhtml all -fut
/usr/local/bin/msda set com.adobe.reader -u com.adobe.pdf all

marcushe
New Contributor II

Another update to our update - running the script above produced a macOS warning that "MosyleMDM needs to be updated" which of course we don't want our users to see. 

Running the python script as bash commands (as seen above) uses the Apple Python 2 engine which generates the warning message described. macOS 12 Monterrey is the last macOS to support Python 2.

The workaround is to embed the bash commands into the package as a postinstall script within the .pkg. Installing the python script and running the commands as postinstall uses the apple installer engine which does not generate that message.

However this of course means the .pkg file cannot be easily updated with newer versions as a postinstall customization has to be made.

This also means the script as-is will not function for future macOS 13 since it is written in Python 2.

That is our workaround for now,