How to set Safari homepage from Terminal? (Or Config profile?)
Hello. I have 80 Macs, each with between 5-10 users (already created), who all need Safari's homepage set to a single site. In previous years, I found this to be an easy task. I could simply modify each user's com.apple.Safari HomePage key to force the user's homepage. I have also accomplished the same task system-wide by simply copying a correctly configured plist into a configuration profile and pushing this out through Profile Manager.
However, things seem to be different now. The devices are all running 10.12.6. I'd heard reports that the homepage was no longer set on these iMacs recently, but I don't know when the issue actually began. In attempting to create a new configuration profile, I've found that there is no HomePage key listed after adding the plist. I've been digging in deeper, trying to get a sense as to why simply using defaults to write the key to a given user's plist doesn't work anymore.
I've found a couple of oddities that I can't explain just yet. Firstly, when I use this command to modify a user's plist:
sudo defaults write /Users/<username>/Library/Preferences/com.apple.Safari.plist HomePage -string "http://school.website.com"
I'm immediately able to turn around and use defaults to read that the key was correctly written. However, after subsequently launching Safari and discovering that the HomePage has not been changed, I use defaults to read the key a second time and it's no longer there. The plist is getting overwritten when Safari launches.
Secondly, I manually set the homepage via Safari simply to http://www.cnn.com and tried to track down where in the user's Preferences it might be stored by doing the tried-and-true split/half method, by removing half of the Preferences and checking to seen when the homepage changes back to default. This has always helped me identify specific preferences, cache files, etc. that have been causing problems. Much to my dismay, even after completely removing the entire Preferences folder from the user account, logging out and back in (allowing a new Preferences folder to be rebuilt), Safari still displays http://www.cnn.com as the homepage! That really threw me for a loop. I have found that a complete rebuild of the entire Library does reset the homepage, so the setting is stored somewhere in the Library... but where?
Any help would be greatly appreciated!
Mac mini, OS X Server, OS X 10.12.6 with Server 5.3