Posted on 11-27-2013 11:16 AM
Hi All,
I am trying to set the homepage for Safari and also have Safari open new windows and tabs to open to the homepage. I've found the commands to set everything (jamf setHomePage etc, defaults write com.apple.Safar NewWindowBehavior and NewTabBehavior), but I'm having trouble pushing to settings to all the users. I captured the change with Composer and created a package and set that to FUT when run, but still no luck. My latest idea was to somehow copy the plist file with the settings I want to all the computers and then run a script or command to copy that to the current users /library/preferences folder and do that all within jamf, but I am getting stuck. I've been searching here and elsewhere trying to piece something together but can't quite get there. Has anyone been able to change the Safari homepage and settings all in one go?
Posted on 11-27-2013 11:23 AM
We use MCX.
http://macmule.com/2013/10/27/how-to-set-safari-7-to-open-at-the-homepage/
You could also use the script examples & run @ login as a launch agent.
Posted on 11-27-2013 11:47 AM
Second bentoms on using MCX or mcxtoprofile if you want to go that route:
Have a look at the Safari 7 preference manifest. Located at /Applications/Safari.app/Contents/Resources/com.apple.Safari.manifest/Contents/Resources/com.apple.Safari.manifest
Note that I did purposely type the Contents/Resources/com.apple.Safari.manifest part twice. Anyway, looking at that text file you can see what all keys and values are valid
Posted on 12-04-2013 06:03 AM
Do I need to do anything special to use MCX if I only want to manage the Safari settings for right now? We use Active Directory and if I could just use MCX to fill in where JAMF can't help with the settings without having to make any changes to AD or the DCs that would be best.
I just looked in Workgroup Manager at the Safari settings. Whenever I have Preferences, Details selected, the Safari preferences are listed no matter which computers I select. Once I set the settings I want, is there a way to select which computers those settings are applied to? I am unable to create new computer lists in the Directory Utility or Workgroup Manager. I want to make sure I don't set something in here and accidentally push it to every computer on our domain.
Posted on 01-24-2014 11:35 AM
So I wanted to take this a step further and have a script write the default settings for Safari 7 for all users or just filling the user template to populate this setting to each user.
So far I can use the ```
defaults write com.apple.Safari NewWindowBehavior -int 0
``` populate the correct setting on the current user but it doesn't seem to fill all existing users or the user template.
Gabe Shackney
Princeton Public Schools
Posted on 01-24-2014 11:40 AM
You could use an approach similar to the one I use to disable the iCloud pop-up. I have that script available here on my GitHub repo:
Posted on 01-24-2014 11:43 AM
I'll see if I can get this to work. I think I used this script before, however I had problems with Mavericks still asking for iCloud info, but worked with 10.7 and 10.8.
Thanks!
Gabe Shackney
Princeton Public Schools
Posted on 02-16-2015 06:32 PM
I have too have tried to get this to work so that when users change the homepage it changes it back, heres my script its not working atm:
#!/bin/sh
# The script checks the system default user template
# for the presence of the Library/Preferences directory.
#
# If the directory is not found, it is created and then the
# Safari settings are set.
for USER_TEMPLATE in "/System/Library/User Template"/*
do
defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.Safari HomePage "http://www.bing.com"
defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.Safari NewWindowBehavior -integer 0
defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.Safari AlwaysRestoreSessionAtLaunch -bool false
done
# The script checks the existing user folders in /Users
# for the presence of the Library/Preferences directory.
#
# If the directory is not found, it is created and then the
# Safari settings are set.
for USER_HOME in /Users/*
do
USER_UID=basename "${USER_HOME}"
if [ ! "${USER_UID}" = "Shared" ]
then
if [ ! -d "${USER_HOME}"/Library/Preferences ]
then
mkdir -p "${USER_HOME}"/Library/Preferences
chown "${USER_UID}" "${USER_HOME}"/Library
chown "${USER_UID}" "${USER_HOME}"/Library/Preferences
fi
if [ -d "${USER_HOME}"/Library/Preferences ]
then
defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.Safari HomePage "http://www.bing.com"
defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.Safari NewWindowBehavior -integer 0
defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.Safari AlwaysRestoreSessionAtLaunch -bool false
chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.Safari.plist
fi
fi
done
fi
exit 0
Any suggestions?
Posted on 06-11-2015 10:46 AM
@blackholemac Thanks for the hint. I was able to use the manifest to find a setting I needed to use to always allow cookies. Worked very well with a configuration profile.
Posted on 11-02-2017 08:00 PM
@leegalan HI, any chance you can share the details of you config profile with me. I am attempting to always allow cookies for our students while they sit a few surveys that require this setting to be on.
Thanks :)
Posted on 11-03-2017 06:07 AM
@pnbahry I just created a plist file called, com.apple.Safari.plist, and the only setting I had in it was BlockStoragePolicy. I set that to 1 or true. Then uploaded it to the Custom Settings part of the configuration profile.
Hope it helps.