macos 在 mac 上运行具有管理员权限的可执行文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10983359/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Run an executable with admin privileges on mac
提问by KMurphy
I created an Adobe Air app that needs to be able to edit the hosts file on a Mac, which you need admin privileges to do. It works with Windows when you run the executable as an administrator. I was wondering how you could do the same on a Mac? If it changes by OS version I'm running Mac OS X 10.7.4
我创建了一个 Adobe Air 应用程序,它需要能够在 Mac 上编辑主机文件,而您需要管理员权限才能执行此操作。当您以管理员身份运行可执行文件时,它适用于 Windows。我想知道你怎么能在 Mac 上做同样的事情?如果它因操作系统版本而改变,我运行的是 Mac OS X 10.7.4
I tried the command sudo open 'Application.app' but it didn't let me edit the file.
我尝试了命令 sudo open 'Application.app' 但它没有让我编辑文件。
Thanks! -Ken
谢谢!-肯
回答by Samit
Try running the app using
尝试使用运行应用程序
sudo Application.app/Contents/MacOS/Application