I’m trying to push a default browser as an initial setting for the first time that a user logs into their machine. I’ve currently got a package working that installs a preconfigured com.apple.launchservices.secure.plist to each user’s ~/Library/Preferences/com.apple.LaunchServices directory. Right now that package works properly to set the default browser once each user has logged out and then logged back in but I haven’t been able to figure out which service I need to reload in order to get this to work as soon as the .plist is first installed.
Ideally the sequence of events would be:
1) User logs in for the first time
2) My preconfigured .plist is installed
3) A postinstall script loads the newly installed .plist and sets the default browser immediately
I pulled the command :
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
from this script https://github.com/aysiu/Mac-Scripts-and-Profiles/blob/main/ChromeDefaultBrowser.sh but it doesn't seem to have any effect on my test machine. Has anybody done this before or have any pointers for doing so?