Ruby or Obj-C request administrator privileges

Discussion in 'Mac Programming' started by Kaliemon, Dec 17, 2008.

  1. Kaliemon macrumors member

    Apr 30, 2006
    I making a program that needs to edit a certain system file. However the since the file is owned by the system I need to get Administrator permission, similar to Installer. Can someone please post an example of doing this in either Ruby or Obj-C, or even C++.

    I know I can run the app through terminal with sudo, but the people who it is for do not want to need to open terminal.

  2. kainjow Moderator emeritus


    Jun 15, 2000
    You can use AuthorizationExecuteWithPrivileges() (lots of examples on the web) to do this. You'll need to write a separate utility that writes to the file.

Share This Page