问题
Since upgraded to macOS Mojave, I find there are permission restrictions to user from accessing ~/Library/Safari/Bookmarks.plist
. So is there an alternative way to do it programmatically? Is there a SafariKit
or something I can use to import bookmarks to my own program? I tried to search online, but no one mentions anything about it. If you guys know, please help me. Thank you
回答1:
You cannot access ~/Library/Safari/Bookmarks.plist anymore because of the stricter security rules in Mojave.
I don't think there's an API to do this specific action yet, so the solution for now is to add the application yourself to System Preferences > Security > Confidentiality > Disk access
.
For example if you add Terminal.app to this Confidentiality subgroup, this will grant access to the whole disk to all commands executed in Terminal, inluding using cat/vim/... to access ~/Library/Safari/Bookmarks.plist.
来源:https://stackoverflow.com/questions/52657293/access-safari-bookmarks-in-macos-mojave-programmatically