Ruby or Obj-C request administrator privileges

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

  1. Kaliemon
    Expand Collapse
    macrumors member

    Joined:
    Apr 30, 2006
    #1
    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.

    Thanks
     
  2. kainjow
    Expand Collapse
    Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    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