Skip to main content

I'm hoping that someone can confirm what I'm seeing. We were hoping to set the safari homepage on our macs through Jamf Pro. But it appears that in Mojave (earlier?), Safari has been containerized so the plist that has the homepage is now under /users/*/library/containers/.... There doesn't appear to be anyway to modify the setting(not via script or configuration profile) unless you turn off SIP first. Is that correct? Or is there something I'm missing?

@sdagley and @a.holley. Apologies for not responding. Jamf created a Jamf ID for me and I can't access my old account. I'm noticing that my script above doesn't work anymore until I grant full disk access to my Code Runner in 10.15.5. I still need to test it while running from Jamf. This post gave me some help with this https://discussions.apple.com/thread/8637915.


@a.holley just tested, my original script using Jamf, it still works. I think you may need to reconfigure your PPPC settings to give the jamf binary full disk access to your builds. You should be able to fix this with the PPPC utility. @jhorn SIP is still enabled on all of my builds.

When testing with Code Runner, remember to add "sudo" to the commands. You also need to ensure that safari is closed during testing. Please reach out if you need any help with this. I am now @bwoods.


Anyone confirm this is working for them with Safari 14.x? I get:

2021-05-12 15:37:27.894 defaults[46370:361899] Rep argument is not a dictionary Defaults have not been changed.

even when running locally….


Script above is still working.


Script above is still working.


@bwoods, If we relaunch the safari again it opens with the default apple page. 


@user-aj what OS version are you running? What is the output of the script?


@user-aj what OS version are you running? What is the output of the script?


MacOS Monterey, it relaunched once with the correct homepage and in safari preferences it shows the default one. After quitting the safari and relaunch it going to the default again.
MacOS Monterey, it relaunched once with the correct homepage and in safari preferences it shows the default one. After quitting the safari and relaunch it going to the default again.

Will do some testing. Haven't looked into this on Monterey yet. Will get back to you.


MacOS Monterey, it relaunched once with the correct homepage and in safari preferences it shows the default one. After quitting the safari and relaunch it going to the default again.

@user-aj It works the same for me on Monterey, but I do understand what you're saying. I mentioned this behavior when I initially created the script. You can't check the safari preferences, or it will revert. Haven't figured a way around this.

 


MacOS Monterey, it relaunched once with the correct homepage and in safari preferences it shows the default one. After quitting the safari and relaunch it going to the default again.

@user-aj Unless you're looking to set the Safari home page and not prevent your users from (easily) changing it the Configuration profile approach mentioned by @jconte earlier in this post works in Monterey.


@user-aj Unless you're looking to set the Safari home page and not prevent your users from (easily) changing it the Configuration profile approach mentioned by @jconte earlier in this post works in Monterey.


Yeah, a configuration profile is the way to go if you don't want them to change it. My org just wants the landing page for the initial setup. They can change it whenever they like afterward.


Yeah, a configuration profile is the way to go if you don't want them to change it. My org just wants the landing page for the initial setup. They can change it whenever they like afterward.


Our requirement is to land the home page for initial setup and change it afterward. After testing it listed the homepage once launched, but gone without changing it


Our requirement is to land the home page for initial setup and change it afterward. After testing it listed the homepage once launched, but gone without changing it


@user-aj You could use a Configuration Profile to make the initial setting, and then provide a Self Service mechanism to exclude the user from that Configuration Profile to "unlock" the setting.


Our requirement is to land the home page for initial setup and change it afterward. After testing it listed the homepage once launched, but gone without changing it


For my script, you basically just have to avoid checking the URL in Safari preferences. If you don't check, it'll open on your page every time. I figured if a user is going into Sefari prefs and checking the URL, they're going to change it anyway. 


@bwoods 

I believe the script stopped working since the elimination of Python 2 in (I believe) 12.3.


Changing the CurrentUser variable to 

CurrentUser=`stat -f "%Su" /dev/console`

fixed the issue


@bwoods 

I believe the script stopped working since the elimination of Python 2 in (I believe) 12.3.


Forgot to post this since that change: 

 

#!/bin/bash HomePage='http://jamfnation.com' CurrentUser=$( scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }' ) # Set Safari Homepage com.apple.Safari defaults write /Users/$CurrentUser/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist HomePage -string $HomePage defaults write /Users/$CurrentUser/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist NewWindowBehavior -int 0 defaults write /Users/$CurrentUser/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist NewTabBehavior -int 0 chown $CurrentUser /Users/$CurrentUser/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist # Flush Preference Cache killall cfprefsd