Updating Safari Extensions

Standard

Extension

As blogged here, here & here I’ve had some fun deploying & creating Safari Extensions.

Recently I needed to update our deployed Extension Bar & like a daft person I didn’t follow Apple’s advised Extension update method..

However, past me was not that daft & had already discovered that all that is needed to “update” an existing Extension is to replace it. Which is pretty much what the below script does.

Many thanks to Peter Bukowinski & Erik Berglund for helping me with this in the #bash channel in the macadmins Slack.

This script will search /Users/*/Library/Safari/Extensions/ for an Extension matching the regex specified at $4 & then replace with the Extension specified at $5.

This below is to be run as root & as mentioned, all that is needed is to replace the existing Extension with the new. However this Extension may be suffixed with a number, (this may have been due to my deployment methods though).

Below is example output & the script is below that:

Script result: Replacing extensions with a name matching: macmule Toolbar with extension located at /private/var/tmp/macmule Toolbar.safariextz...
/private/var/tmp/macmule Toolbar.safariextz -> /Users/Administrator/Library/Safari/Extensions/macmule Toolbar-2.safariextz
/private/var/tmp/macmule Toolbar.safariextz -> /Users/Administrator/Library/Safari/Extensions/macmule Toolbar.safariextz
/private/var/tmp/macmule Toolbar.safariextz -> /Users/btoms/Library/Safari/Extensions/macmule Toolbar.safariextz
/private/var/tmp/macmule Toolbar.safariextz -> /Users/jdoe/Library/Safari/Extensions/macmule Toolbar-2.safariextz
/private/var/tmp/macmule Toolbar.safariextz -> /Users/jbloggs/Library/Safari/Extensions/macmule Toolbar.safariextz
Extensions updated in 4 Home folders...

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.