Search Unity

Start new process with admin rights on MAC

Discussion in 'General Discussion' started by Jochanan, Nov 21, 2019.

  1. Jochanan

    Jochanan

    Joined:
    Nov 9, 2016
    Posts:
    85
    I am windows user. I am able to execute process as admin on windows like that
    Code (CSharp):
    1.  
    2. public void ExecuteAsAdmin(string fileName, string args)
    3. {
    4.     Process proc = new Process();
    5.     proc.StartInfo.FileName = fileName;
    6.     proc.StartInfo.UseShellExecute = true;
    7.     proc.StartInfo.Verb = "runas";
    8.     proc.StartInfo.Arguments = args;
    9.     proc.Start();
    10. }
    11.  
    Wit this code, UAC is triggered and everything is working as it should. Unfortunatelly, i am not able to achieve it on MAC. Do you know, whether/how can i achieve it?
    Do i run SUDO app there with parameter?
     
  2. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,204
    Joe-Censored likes this.
  3. Jochanan

    Jochanan

    Joined:
    Nov 9, 2016
    Posts:
    85
    So basically i fill startinfo filename with sudo and arguments with path to the application which i would like to run?
     
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,204
    Yes. I don't know how it's handled on macOS but on Linux there will be a prompt that appears asking for a password. I don't know if you can supply the password ahead of time to sudo.
     
  5. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Out of interest what do you need admin rights for your app? Sounds a bit, well sketchy? Could be legit OC. People get a bit unsure when the app needs to run a process under admin.
     
  6. Jochanan

    Jochanan

    Joined:
    Nov 9, 2016
    Posts:
    85
    The app is updating itself (you need to have two apps actually), but you cannot overwrite the files unless you have admin rights
     
  7. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Just saw this not sure if it any use to you though or how decent it is - seems pretty old 2006 although last commit was 9 days ago?

    https://sparkle-project.org/
     
  8. Jochanan

    Jochanan

    Joined:
    Nov 9, 2016
    Posts:
    85
    I have found out, that you cannot just run sudo on its own. Any thoughts guys?
     
  9. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Skip Mac? :)
     
  10. Jochanan

    Jochanan

    Joined:
    Nov 9, 2016
    Posts:
    85
    i wish i could. I hate that system already
     
    AndersMalmgren likes this.