Skip to main content
Solved

How to change the default browser to Google Chrome?

  • December 3, 2013
  • 40 replies
  • 168 views

Forum|alt.badge.img+14

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.

Best answer by eukatc

@jhuls you can set it up in the JSS as a managed preference (Managed Preference > Internet Configuration > Default Web Browser) and then if not done already setup the iMacs in that lab into a Static Computer group and just scope the managed preference to the lab.

40 replies

Forum|alt.badge.img+5
  • New Contributor
  • Answer
  • December 4, 2013

@jhuls you can set it up in the JSS as a managed preference (Managed Preference > Internet Configuration > Default Web Browser) and then if not done already setup the iMacs in that lab into a Static Computer group and just scope the managed preference to the lab.


Forum|alt.badge.img+14
  • Author
  • Valued Contributor
  • December 4, 2013

Thanks...somehow I missed that.

After posting this I did find a command line app called duti that looks like it might let me do the same thing but I'll definitely explore both to see which one I prefer.

Thanks again!


Forum|alt.badge.img+16
  • Valued Contributor
  • December 4, 2013

I believe the plist that holds the default browser setting is ~/Library/Preferences/com.apple.LaunchServices.plist. We create a modified dmg of this plist and deploy it to FEU and FUT. As you state, there are usually several options to complete a single task. Good luck. -Mark


Forum|alt.badge.img+14
  • Author
  • Valued Contributor
  • December 4, 2013

I just came across this on my Mavericks install while snooping around. Deploying via dmg is an interesting option as well. Thanks!

Almost all of my administration experience has been in the Windows world so I'm still wrapping my head around how things get done on this side of the fence and what my options are. I think I need to find a good resource for learning more about preferences and plists and what's in them. In the Windows world group policies and preferences are pretty simple to work with and fairly well explained and if it's not enough you just dig into the registry. Here it seems thus far it's not quite as intuitive on the administration side.

Thanks again!


Forum|alt.badge.img+9
  • Valued Contributor
  • August 17, 2015

I know this is an old post, but maybe just maybe someone like me is stuck with Yosemite, and comes across this.

Run the following lines in a login script to set the browser as default for each user.

Assuming Chrome is already installed:

open -a "Google Chrome" --args --make-default-browser
sleep 1
sqlite3 /Library/Application Support/com.apple.TCC/TCC.db "REPLACE INTO access VALUES('kTCCServiceAccessibility','com.apple.loginwindow',0,1,1,NULL);" 
osascript -e 'tell application "System Events" to tell process "CoreServicesUIAgent" to tell window 1 to click button 1' >/dev/null 2>&1
sqlite3 /Library/Application Support/com.apple.TCC/TCC.db "delete from access where client='com.apple.loginwindow';"

Very subtle solution and works quite nicely.

Kamal


bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • August 22, 2015

This is exactly the thing that duti is for.

Install the binary, then run something like the below triggered via a launchAgent.

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

Forum|alt.badge.img+14
  • Author
  • Valued Contributor
  • August 24, 2015

Thanks @greatkemo and @bentoms . I just got a lab in of Yosemite based systems and have to deal with this now. Your posts are timely...I'll give them a try...thanks!


Forum|alt.badge.img+6

It's worth mentioning the in El Capitan they added another table so you just add an additional NULL:

open -a "Google Chrome" --args --make-default-browser
sleep 1
sqlite3 /Library/Application Support/com.apple.TCC/TCC.db "REPLACE INTO access VALUES('kTCCServiceAccessibility','com.apple.loginwindow',0,1,1,NULL,NULL);" 
osascript -e 'tell application "System Events" to tell process "CoreServicesUIAgent" to tell window 1 to click button 1' >/dev/null 2>&1
sqlite3 /Library/Application Support/com.apple.TCC/TCC.db "delete from access where client='com.apple.loginwindow';"

Forum|alt.badge.img+7
  • Contributor
  • March 24, 2016

sorry to interrupt the discussion since we have 10.10.4 script runs without any errors but still safari is default browser and when I click on the Chrome it asks if I want to make it default.


Forum|alt.badge.img+20
  • Contributor
  • June 14, 2017

@eukatc I know this post has been a few years now, but would your solution still work today? on Sierra ? wanting to set Google Chrome as the default browser?

I am trying your solution, using the below value to set the managed preferences --> internet configuration --> default web browser

it doesn't seem to do anything anyways. I scope it to a test group of 2 computers and I check system preferences --> general -- Safari is still listed as the default web browser.

here is another question; whats the point of setting the default web browser? the user can use whatever browser they want !! we have Safari,Firefox and Google Chrome installed!! how would setting the default web browser help if a user prefers to use a different browser over the browser I want to set as default ???

We have a certain Web application that works better in Google Chrome versus Safari -- so this is why I want to set the default browser. But if the user uses Safari to access that web application, what is the point of setting Google Chrome as the default browser?

"/Applications/Google Chrome.app"


Forum|alt.badge.img+5
  • New Contributor
  • June 14, 2017

@tcandela haven't tested it on Sierra but don't see no reason why it wouldn't work, thats the right file path for the config


Forum|alt.badge.img+16
  • Valued Contributor
  • June 14, 2017

In macOS 10.12 the plist that holds the default browser settings has moved to: ~/Library/Preferences/com.apple.LaunchServices/com.apple.LaunchServices.plist.
-Mark


Forum|alt.badge.img+20
  • Contributor
  • June 14, 2017

@mark.sampers I went to that location and the com.apple.LaunchServices folder was empty, so I went to system preferences --> General and changed the default web browser from Safari to Google Chrome. Upon making this change, immediately a file was created in this empty folder

com.apple.launchservices.secure.plist

what process did you do to create your dmg? I don't need it to mess with FEU just want it setup for newly configured macs from this point on. so would it be FUT ?

do i just drag that .plist file into Composer ?


Forum|alt.badge.img+16
  • Valued Contributor
  • June 14, 2017

@tcandela I used the same process you described. FUT would work. I normally use check both FEU and FUT in case a package needs to be pushed out before a re-image.


Forum|alt.badge.img+20
  • Contributor
  • June 14, 2017

@mark.sampers thanks, I am clear on the FEU/FUT option i want to select, but in order to create the dmg do i just simply drag the file com.apple.launchservices.secure.plist from the com.apple.LaunchServices folder into composer


Forum|alt.badge.img+16
  • Valued Contributor
  • June 14, 2017

@tcandela Yes, drag the plist into composer and create the dmg. Note: I normally create the package using a local management account that is part of our base macOS. (Doing so allows the package to be installed properly during imaging. At least in our work flows.)


Forum|alt.badge.img+20
  • Contributor
  • June 14, 2017

@mark.sampers ok. dmg created.

When saving it into Casper Admin would i check the box INSTALL ON BOOT DRIVE AFTER IMAGING ?


Forum|alt.badge.img+20
  • Contributor
  • June 14, 2017

@mark.sampers ok. dmg created.

When saving it into Casper Admin would i check the box INSTALL ON BOOT DRIVE AFTER IMAGING ?


Forum|alt.badge.img+13
  • Valued Contributor
  • June 14, 2017

You could also try using lsregister. I don't have specific examples as I've just started looking into it as well but there is a frontend called duti for it.
Details here: http://krypted.com/mac-security/lsregister-associating-file-types-in-mac-os-x/


Forum|alt.badge.img+16
  • Valued Contributor
  • June 14, 2017

I normally don't. (Again, this is the reason I create the package using a local management/admin account that is part of our base OS.) Your environment may be different. You'll want to test the package and adjust it if needed. Good Luck.


Forum|alt.badge.img+20
  • Contributor
  • June 14, 2017

@mark.sampers i tested it via creating a policy, then i manually created 2 accounts, logged into each account and checked system preferences --> General and the default web browser set to Google Chrome

I created a web link in a word document, Google Chrome opened, but then i was greeted with 2 popups

1 - this is an application open from the internet, do you want to open it .............. you know that popup message
2 - do you want to make Google Chrome as your default browser

how would i get rid of these 2 ugly popups ?


Forum|alt.badge.img+20
  • Contributor
  • June 14, 2017

@mark.sampers i tested it via creating a policy, then i manually created 2 accounts, logged into each account and checked system preferences --> General and the default web browser set to Google Chrome

I created a web link in a word document, Google Chrome opened, but then i was greeted with 2 popups

1 - this is an application open from the internet, do you want to open it .............. you know that popup message
2 - do you want to make Google Chrome as your default browser

how would i get rid of these 2 ugly popups ?


Forum|alt.badge.img+16
  • Valued Contributor
  • June 14, 2017

@tcandela Those pop-ups are probably related to your Google Chrome package. When creating a Google Chrome package, I will normally launch Chrome and adjust settings before packaging with Composer. Depending on your needs, the "Pre-installed Software" option in Composer may help package Google Chrome.


Forum|alt.badge.img+20
  • Contributor
  • June 15, 2017

@mark.sampers I see now. My google chrome installs on each computer after enrollment using a script that was pulled from the jamf nation scripts. It runs monthly to check to see if each computer is running the latest version, if not it updates it with the latest version.

Since this computer was just enrolled, and the first time google chrome was run from that user account that is why those pop-ups appeared.

I like using this script over having to make new package each time


Forum|alt.badge.img+13
  • Valued Contributor
  • June 15, 2017

Not sure if you want this or not, but if you want Chrome to autoupdate, below is a script I found from Hannes Juutilainen. https://github.com/hjuutilainen/adminscripts/blob/master/chrome-enable-autoupdates.py