![]() ![]() ![]() Private typealias AuthorizationExecuteWithPrivilegesImpl = ( So what I do now is authenticate a call to mytool -install using AuthorizationExecuteWithPrivileges like this: import Foundation Well I dug out the deprecated API using dlsym, because there is simply no other way besides asking the user manually for his password, which I don't want to do unless the deprecated API disappears entirely. PS: The app is not sandboxed, so NSOpenPanel does not help. So how do I manage to perform a privileged file copy in Swift? Also SMJobBlessrequires my helper tool to have an ist of its own, which it doesn't have since its just a plain binary The problem here is that AuthorizationExecuteWithPrivileges is deprecated (or in my case not even available in Swift), and SMJobBless seems to be only for longer running helper processes. Manually getting Authorization via AuthorizationCreate. This does not seem to work, as I still get a privileges error after trying to "replace" the file in /usr/local/bin/mytool with the one from my bundle. Getting an authorization for replaceFile for NSWorkspace.requestAuthorization I looked into different ways to do this, but none are satisfactory (or I am doing it wrong) Now bin might not always exist or have write access, so the standard NSWorkspace calls will fail on it. I have a helper binary mytool inside my main app bundle that I need to copy to /usr/local/bin. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |