Info

NOTE: These posts are being re-created from old Jamf Nation posts not because they are the best but because they may have useful things that were mangled in the Jamf Nation transition to its most recent hosting platform.

That, & they were always supposed to be blog posts anyway… I didn’t have a blog then.




It is an objective fact that The Beach Boys are one of the 5 most overrated musical acts of all time (the others are The Who, The Doors, The Grateful Dead, & Elvis Presley). However, that discussion will have to wait for another time & place…

It is fun when you can still do something slightly interesting with .plist modification.

To wit: a thing for customizing the toolbar in Safari. I am not going to make a script, I’ll leave that to you, but, here are the raw ingredients:

crntusr=$(stat -f %Su /dev/console)
- Current user (however you get that...) because Safari preferences are in the user domain.

sudo -u "$crntusr" defaults read /System/Volumes/Data/Users/"$crntusr"/Library/Containers/com.apple.Safari/Data/Library/Preferences com.apple.Safari.plist 'NSToolbar Configuration BrowserStandaloneTabBarToolbarIdentifier'
- Read the .plist with defaults (you can also read it with PlistBuddy).

sudo pkill -ail Safari
sudo -u "$crntusr" /usr/libexec/PlistBuddy -c "add 'NSToolbar Configuration BrowserStandaloneTabBarToolbarIdentifier':'TB Item Identifiers':4 string HomeToolbarIdentifier" /System/Volumes/Data/Users/"$crntusr"/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist
- The PlistBuddy syntax (as always) is a little challenging, but, what's happening is:
  • An entry is created in the array:
    • 'NSToolbar Configuration BrowserStandaloneTabBarToolbarIdentifier':'TB Item Identifiers'
  • In this example the Home page button is added
  • An index is chosen for where the button should be positioned relative to what is already on the toolbar
  • The index order is from left to right
- Make sure Safari is not running when this change is made.

open /System/Applications/Safari.app
- Open Safari & marvel at how computers work...


Before

Before


After

After

Enjoy!


Source: https://community.jamf.com/general-discussions-2/surfin-safari-33364