I am unable to install my extension to safari from

2019-01-28 17:14发布

问题:

Hi I am unable to install my extension to safari from commandline (OS X 10.5.8 Safari 5+)

In my postinstall script for PackageMaker.app, first i am coping my extension to "/tmp/my-product/" and then i am running this $ sudo /Applications/Safari.app/Contents/MacOS/safari /tmp/my-product/my-extension.safariextz

This temporarily puts the extension in safari, but on closing safari the extension vanishes.

Console.app shows this in system.log

*12/07/10 12:45:22.158: 9387 [WARNING] SQL Error: SQLITE_CANTOPEN[14.0]: Database file not found
12/07/10 12:45:22.163: 9387 [WARNING] ***** SQL error opening database: SQLITE_CANTOPEN[14.0]: Database file not found
12/07/10 12:45:22.219: 9387 [WARNING] SQL Error: SQLITE_CANTOPEN[14.0]: Database file not found
12/07/10 12:45:22.219: 9387 [WARNING] SQLite::Exception "SQLITE_CANTOPEN[14.0]: Database file not found" caught in static void PubSub::ClientCore::openClientSession()
12/07/10 12:45:22.219: 9387 [WARNING] std::exception "St9exception" caught in PSClient* +[PSClient clientForBundleIdentifier:](objc_object*, objc_selector*, NSString*)
12/07/10 12:45:22.220: 9387 [WARNING] SQL Error: SQLITE_CANTOPEN[14.0]: Database file not found
12/07/10 12:45:22.220: 9387 [WARNING] ***** SQL error opening database: SQLITE_CANTOPEN[14.0]: Database file not found
12/07/10 12:45:22.276: 9387 [WARNING] SQL Error: SQLITE_CANTOPEN[14.0]: Database file not found
12/07/10 12:45:22.276: 9387 [WARNING] SQLite::Exception "SQLITE_CANTOPEN[14.0]: Database file not found" caught in static void PubSub::ClientCore::openClientSession()
12/07/10 12:45:22.276: 9387 [WARNING] std::exception "St9exception" caught in PSClient* +[PSClient clientForBundleIdentifier:](objc_object*, objc_selector*, NSString*)
2010-12-07 12:45:22.276 Safari[9387:a0b] WARNING: BookmarkedFeedsManager couldn't get PSClient!
12/07/10 12:45:22.278: 9387 [WARNING] SQL Error: SQLITE_CANTOPEN[14.0]: Database file not found
12/07/10 12:45:22.278: 9387 [WARNING] ***** SQL error opening database: SQLITE_CANTOPEN[14.0]: Database file not found
12/07/10 12:45:22.334: 9387 [WARNING] SQL Error: SQLITE_CANTOPEN[14.0]: Database file not found
12/07/10 12:45:22.334: 9387 [WARNING] SQLite::Exception "SQLITE_CANTOPEN[14.0]: Database file not found" caught in static void PubSub::ClientCore::openClientSession()
12/07/10 12:45:22.334: 9387 [WARNING] std::exception "St9exception" caught in PSClient* +[PSClient clientForBundleIdentifier:](objc_object*, objc_selector*, NSString*)*

Is it a permission issue?

I am stuck here :(

Please suggest.

Thanks in advance

Regards

Parimal Das

回答1:

I imagine part of the problem is that you're running Safari as root. There's no reason to do this and in fact it's rather unsafe.

Ideally you just open the extension (with open or AppleScript, for example), which prompts the user to install the extension. If you're trying to do an unattended installation, this isn't terribly helpful though.

If you're just doing this for in-house deployment and don't mind if it breaks on a Safari upgrade, then you can quit Safari, install the extension into ~/Library/Safari/Extensions and update ~/Library/Safari/Extensions/Extensions.plist (the format is rather obvious; /usr/libexec/PlistBuddy is useful for such things).



标签: macos safari