Skip to main content
Question

Setting Safari behavior

  • November 27, 2013
  • 10 replies
  • 56 views

Forum|alt.badge.img+6

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?

10 replies

bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • November 27, 2013

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.


Forum|alt.badge.img+26
  • Valued Contributor
  • November 27, 2013

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


Forum|alt.badge.img+6
  • Author
  • Contributor
  • December 4, 2013

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.


Forum|alt.badge.img+18
  • Esteemed Contributor
  • January 24, 2014

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


Forum|alt.badge.img+33
  • Hall of Fame
  • January 24, 2014

@gshackney][/url,

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:

https://github.com/rtrouton/rtrouton_scripts/blob/master/rtrouton_scripts/disable_icloud_pop_up/disable_icloud_pop_up.sh


Forum|alt.badge.img+18
  • Esteemed Contributor
  • January 24, 2014

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


Forum|alt.badge.img+5
  • Contributor
  • February 17, 2015

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?


Forum|alt.badge.img+4
  • New Contributor
  • June 11, 2015

@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.


Forum|alt.badge.img+4
  • Contributor
  • November 3, 2017

@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 :)


Forum|alt.badge.img+4
  • New Contributor
  • November 3, 2017

@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.