MacOS – Safari extensions have suddenly stopped working (10.13.4)

high sierramacossafarisafari-extensions

All of a sudden this morning my extensions stopped working. The extensions preference pane is empty and says "No extensions".

All the extensions are left in ~/Library/Safari/Extensions, and if open one of them to install it says (roughly translated):

Safari can not install this extension

An error occured when the ”NinjaKit” extension was installed.

I tried restoring the entire ~/Library/Safari folder and ~/Library/Preferences/com.apple.Safari.plist from a backup from yesterday when everything was working fine, but that did not solve it.

The issue may stem from wrong permissions somewhere, since if I try to edit the Extensions.plist file manually it says "Unlocking failed for an unknown reason." when I try to save it. I tried sudo chmod -R 0777 ~/Library/Safari/Extensions but that did not solve the issue either. The file is not locked from the "Get Info" view in Finder.

Best Answer

The permissions issue ended up being the problem that prevented me from using extensions.

For some reason, it keeps the weird time machine permissions (you can't edit a time machine backup etc.) when I copy over the Safari folder through Finder. It shouldn't do this and never has for me before this.

But I solved it by instead copying it over through the terminal, using cp, which doesn't preserve any metadata unless I specify that it should do that. After doing that, I had to reinstall the extensions (and thus lost some extension data) but at least they work now.

EDIT: I was able to recover the lost data, from a backup of ~/Library/Preferences/com.apple.Safari.Extensions.plist