Skip to main content

I've received a request to change a lab of iMacs over to Google Chrome as the default browser. The lab is currently equipped with Snow Leopard and Chrome is already installed. Safari is the default browser at the moment.



I've attempted to do some internet searches on how to do this but come up short since I'm wading through tons of sites explaining how to change it via the gui. Has anyone done this via Casper or are aware of how I could implement such a solution? This needs to be something I can automate as I can see this getting requested in other labs soon.



Thanks in advance.

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


@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


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'


@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.


@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?


@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 :)


@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.


@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.


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


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.


@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?


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.


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?


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.


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