Skip to main content
Solved

How to change the default browser to Google Chrome?

  • December 3, 2013
  • 40 replies
  • 233 views

Show first post

40 replies

Forum|alt.badge.img+3
  • New Contributor
  • July 20, 2017

@greatkemo hi, the script worked, but do you have any idea how can I add some bookmarks to the gogle chrome using a script?


Forum|alt.badge.img+9
  • Valued Contributor
  • July 20, 2017

@lsegura best thing to do with bookmarks is package them from admin machine with composer and deploy them to FUT and FEU.

The path to the bookmarks you need to package I believe is ~/Library/Application Support/Google/Chrome/Default/Bookmarks

Kamal


Forum|alt.badge.img+5

Hi @bentoms I tried the command on El Capitan from your post and got the error 'failed to set com.google.chrome as handler for public.HTML (error -54)

'duti -s com.google.chrome public.html all'


stevewood
Forum|alt.badge.img+38
  • Hall of Fame
  • August 16, 2017

@HelpDeskWarrior I just spent 4 days trying to set Chrome as default. I tried everything from:

I found several articles talking about setting the default browser, including this discussion, but none of the methods worked. Alan Siu had a good post over here about changing Launch Services, and at the bottom indicates that Google Chrome just cannot be changed. I tried his script, ChromeDefaultBrowser.sh, but again, had no luck.

My goal was to do two things: 1) set Chrome as default, and 2) get rid of the welcome dialog and all other dialogs on the first run. I was able to accomplish the second by utilizing the Python script that @daz_wallace came up with in his blog post How to stop first run messages in Google Chrome.

Unfortunately, to meet my first goal I had to do something I hate doing: capture the LaunchServices settings via Composer. Actually, I just packaged up the settings, so I could have used my preferred tool, Packages, but Composer was easier in this case.

Unless someone has newer information, or another method to set the default browser without getting any pop-up dialogs, I'll just trudge forth with replacing the LaunchServices plist for the user.


Forum|alt.badge.img+5

@stevewood Thanks for a detailed response, it's a relief to know that this is not such an easy task. Can you expand more on what you mean by capturing launch services? I am familiar with using composer. Does this actually work?


smithjw
Forum|alt.badge.img+11
  • Contributor
  • August 17, 2017

@stevewood I'm really hoping you find a scriptable way to set Chrome as default as I'd love to do this as part of my onboarding :)


stevewood
Forum|alt.badge.img+38
  • Hall of Fame
  • August 17, 2017

@HelpDeskWarrior Take a VM, or a fresh machine, with just the OS, Chrome, and Composer added to it. Set Chrome to be the default browser either by using the System Preferences -> General pref pane, or by opening Chrome and setting Chrome as default. Once you have done that, open Composer and cancel out of the new package screen (Normal, New & Modified...) so that you are at the main composer window.

Open a new Finder window and navigate to ~/Library/Preferences/com.apple.LaunchServices/. Drag what should be the only file in that folder, com.apple.launchservices.secure.plist, to the left sidebar of the Composer window. Composer should then show you that folder structure added. From there, create a DMG file, upload to Casper Admin (or the JSS), and choose FEU & FUT under the options for the package.

Now that you have that DMG uploaded, create a new policy to deploy at login. I used a trigger of "Once per user" and scoped to machines enrolled in the last day. That way I hopefully do not pickup existing machines.

You can also look at using Outset to kick off the policy if you really wanted to.

@smithjw yeah, I was really hoping I would find a scripted solution, but I didn't. Apple must have changed something with either 10.12 or one of the later revs of 10.12 (perhaps 10.12.4?) that prevents the use of tools like duti or LaunchSetter, and makes tools like cdef and defaultbrowser kick up that pop-up. It's really annoying. I'd be fine if I could set this with a Configuration Profile, which to me would be the easiest and most logical method for doing this.

Hopefully I'm either completely missing something and someone else will comment with a solution that my Google-fu did not find, or Apple will fix this so we can set the default browser.


stevewood
Forum|alt.badge.img+38
  • Hall of Fame
  • August 17, 2017

@HelpDeskWarrior thinking over my previous response, I guess you do not necessarily have to use a VM or a new machine. Since the setting is a per user setting, you could just create a new user on the machine and log in under that user to create the necessary plist.


Forum|alt.badge.img+4
  • Contributor
  • August 22, 2017

I modified the script @stevewood mentioned above. It didn't work out of the box, but I figured out a method of getting the setting to stick and not leave a bunch of detritus in the plist. It works.

https://github.com/primalcurve/macsupportpub/blob/master/scripts/setGoogleChromeAsDefaultBrowser_Scrubbed.sh


Forum|alt.badge.img+5

Thanks @primalcurve this script works perfectly for me.

Thanks for your efforts as well @stevewood unfortunately, your suggestions didn't work for me. Perhaps it was my execution.


Forum|alt.badge.img+3
  • New Contributor
  • October 10, 2018

@primalcurve I tried using your modified script on 10.14 and found that while it did set chrome as the default browser, it messed up a lot of my application and dock icons to be the generic icons. I had to revert because of that ... any known solutions?


Forum|alt.badge.img+1
  • New Contributor
  • November 14, 2019
I tried using your modified script on 10.14 and found that while it did set chrome as the default browser, it messed up a lot of my application and dock icons to be the generic icons. I had to revert because of that ... any known solutions?

@lennyvaknine43 Did you ever come up with a fix for this? Or did @primalcurve fix his script? I just tried it on a test machine and it reset all my icons as well.


Forum|alt.badge.img+3
  • New Contributor
  • March 9, 2020

So I have used @primalcurve script and does seem to do the trick for me, no issues with my dock. It's scoped in a policy which runs when the user logs on. However, even though the script does set the default browser to chrome when chrome is launched, it still prompts do you want to make chrome the default browser. Does anyone know of an addition to the script to suppress this pop-up message?


Forum|alt.badge.img+4
  • New Contributor
  • June 9, 2020
However, even though the script does set the default browser to chrome when chrome is launched, it still prompts do you want to make chrome the default browser.

Have a look at this: https://cloud.google.com/docs/chrome-enterprise/policies/?policy=DefaultBrowserSettingEnabled

I use this to preinstall certain Chrome extensions in the browser. I too want to suppress that Google default popup.


Forum|alt.badge.img+3
  • New Contributor
  • March 2, 2021

I am also interested in suppressing that Google "default" pop up. Has anyone found a solution?