Setting Safari Homepage in Mojave with SIP

brian_eybs
New Contributor III

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?

42 REPLIES 42

jlombardo
Contributor

@bwoods 

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

bwoods
Valued Contributor

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

 

jlombardo
Contributor

Changing the CurrentUser variable to 

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

fixed the issue