Looking at the big picture, it seems like you’re trying to read the messages being managed by the Messages app. There’s no API to do that. Moreover, the location and format of the message database is not considered API, and if you built an app based on that you are likely to run into compatibility problems moving forward.
I try to run a query I get … authorization denied
Yep. I believe that’s protected by MAC, as defined in On File System Permissions.
Note that Messages has an AppleScript interface, so you can get some information from it that way. I don’t think it offers access to the individual messages though.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"