Need to enable flash in safari using script

app2pack
New Contributor II

I have written a script to run as post install in order to enable flash in safari after installing adobe flash player 24. The script is using plistbuddy to edit the com.apple.safari.plist file in order to set the below values which are responsible to enable flash.(Tested manually and it works)

/usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.macromedia.Flash Player.plugin:PlugInFirstVisitPolicy string PlugInPolicyAllowWithSecurityRestrictions" /Users/abc/Library/Preferences/com.apple.Safari.plist

/usr/libexec/plistbuddy -c "add PlugInInfo:com.macromedia.Flash Player.plugin:plugInCurrentState bool true" /Users/abc/Library/Preferences/com.apple.Safari.plist

After installing flash (the post install script is run). I verified opening terminal and using defaults read com.apple.Safari.plist. The values are indeed added. But when I launch safari, I see that it shows flash is disabled and need to enable it by changing in preferences. I checked again using defaults read and indeed the values are reverted back to other. The values are not what I have set. Have anyone able to successfully enable flash in safari? Kindly provide your suggestions.

2 REPLIES 2

app2pack
New Contributor II

The below links helped a lot. I used killall cfprefsd and it now works fine.
https://macmule.com/2014/02/07/mavericks-preference-caching/
http://hints.macworld.com/article.php?story=20130908042828630

McGinn
Contributor

Has anyone had success with this for Safari 12 and MacOS 10.14.4?

It looks like apple has removed com.apple.Safari.plist from Mojave.