4

I'd like to open a specific macOS application which require root privileges (uid=0 or gid=0) in order to access specific files. However, when trying to run with sudo directly I get the following error:

sudo /Applications/myApp.app/Contents/MacOS/myApp
Illegal instruction: 4

and if running it indirectly using open it gets the uid of current user and not root.

any ideas who to do it ?

4
  • Do you have access to the application's source code? Is this an application you have created? Commented Mar 16, 2020 at 14:51
  • yes, and I give access to encrypted files only if running from root (uid=0)
    – Zohar81
    Commented Mar 16, 2020 at 14:52
  • Perhaps you can advise using privilege elevation option upon entering root credentials ? I see that the method for this is already deprecated (AuthorizationExecuteWithPrivileges). So I have to use the SmJobBless, right ?
    – Zohar81
    Commented Mar 16, 2020 at 14:56
  • 2
    If the files are encrypted anyway and a password is required to access them, why go through all the pain of limiting access to a specific user? If the encryption is done right it will not add an additional layer of security; if it's done wrong it gives you a false sense of security.
    – nohillside
    Commented Mar 16, 2020 at 15:18

1 Answer 1

4

Security Risk

macOS is not designed to have general applications run as the root user. This would be viewed as a security risk by Apple's engineers.

XPC Services

Running a graphical application, and all the frameworks that requires, as root is not advisable. The surface area for security problems and mistakes is huge.

AuthorizationExecuteWithPrivileges is now deprecated. Instead, Apple promote XPC Services as a way dividing up sections of applications that require higher privileges.

2
  • This doesn't answer the question. It is true that someone who wants to run a GUI app as root is probably making a mistake, but the correct answer should explain how to do it in addition to warnings
    – Max Coplan
    Commented May 21 at 21:56
  • @MaxCoplan please can you ask a new question mentioning the graphical application you want to run as root and the task you want to achieve. Commented May 22 at 6:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .