I'm trying to figure out how I can access the ~/Library/Messages
folder in my macOS app (swift). Specifically, I'm trying to access the chat.db
file.
If I do the following (without sandbox), I get an open error.
let url = try? FileManager.default.url(for: .libraryDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
url = url!.appendingPathComponent("Messages", isDirectory: true).appendingPathComponent("chat.db", isDirectory: false)
// Then open this file...
If I instead point the user to the folder using an Open Dialog, I get a forbidden sign on the folder icon.
What permission do I need to be able to access this file? I've tried Accessibility but that doesn't seem to be it (and also I didn't grant iTerm accessibility and I can still go to that folder). Any pointer is appreciated. Thanks!
(I only need access to this one single file. If there's a way to do it in sandbox, I'd love to go that route. If that's not possible, asking for whatever permission is fine.)