Need to enable flash in safari using script

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 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/

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

After installing flash (the post install script is run). I verified opening terminal and using defaults read 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.


New Contributor II

The below links helped a lot. I used killall cfprefsd and it now works fine.


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

It looks like apple has removed from Mojave.