在 Xcode / Mac OS 中授权非管理员开发人员
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1837889/
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
Authorize a non-admin developer in Xcode / Mac OS
提问by Andrew Cain
I use a standard user account for my daily tasks on Mac OS. Since upgrading to Snow Leopard I am asked to do the following when a program is run from within Xcode:
我在 Mac OS 上使用标准用户帐户执行日常任务。自从升级到 Snow Leopard 后,当程序在 Xcode 中运行时,我被要求执行以下操作:
"Type the name and password of a user in the 'Developer Tools' group to allow Developer Tools Access to make changes"
“在‘开发者工具’组中输入用户的名称和密码以允许开发者工具访问进行更改”
While I know the admin username/password, this is annoying (though only required once per login).
虽然我知道管理员用户名/密码,但这很烦人(尽管每次登录只需要一次)。
The developer tools access is asking for rights to "system.privilege.taskport.debug" from application gdb-i386-apple-darwin.
开发人员工具访问要求从应用程序 gdb-i386-apple-darwin 获得“system.privilege.taskport.debug”的权限。
What is the best way around this?
解决这个问题的最佳方法是什么?
回答by Ned Deily
You need to add your OS X user name to the _developer
group. See the posts in this threadfor more information. The following command should do the trick:
您需要将您的 OS X 用户名添加到该_developer
组中。有关更多信息,请参阅此线程中的帖子。以下命令应该可以解决问题:
sudo dscl . append /Groups/_developer GroupMembership <username>
回答by chunkyguy
Finally, I was able to get rid of it using DevToolsSecurity -enable
on Terminal.
Thanks to @joar_at_work!
最后,我能够DevToolsSecurity -enable
在终端上使用它来摆脱它。感谢@joar_at_work!
FYI: I'm on Xcode 4.3, and pressed the disablebutton when it launched for the first time, don't ask why, just assume my dog made me do it :)
仅供参考:我在 Xcode 4.3 上,并在它第一次启动时按下了禁用按钮,不要问为什么,假设我的狗让我这样做:)
回答by cdespinosa
$ dseditgroup -o edit -u <adminusername> -t user -a <developerusername> _developer
回答by phoebus
You should add yourself to the Developer Tools group. The general syntax for adding a user to a group in OS X is as follows:
您应该将自己添加到开发人员工具组。在 OS X 中将用户添加到组的一般语法如下:
sudo dscl . append /Groups/<group> GroupMembership <username>
I believe the name for the DevTools group is _developer
.
我相信 DevTools 组的名称是_developer
.
回答by Kheldar
Ned Deily's solution works perfectly fine, provided your user is allowed to sudo
.
斯内德Deily的解决方案工作完全正常,只要你的用户被允许sudo
。
If he's not, you can su
to an admin account, then use his dscl . append /Groups/_developer GroupMembership $user
, where $user is the username.
如果他不是,您可以su
使用管理员帐户,然后使用他的dscl . append /Groups/_developer GroupMembership $user
,其中 $user 是用户名。
However, I mistakenly thought it did not because I wrongly typed in the user's name in the command and it silently fails.
但是,我错误地认为它没有,因为我在命令中错误地输入了用户名并且它默默地失败了。
Therefore, after entering this command, you should proof-check it. This will check if $user is in $group, where the variables represent respectively the user name and the group name.
因此,输入此命令后,应进行校对检查。这将检查 $user 是否在 $group 中,其中变量分别代表用户名和组名。
dsmemberutil checkmembership -U $user -G $group
This command will either print the message user is not a member of the group
or user is a member of the group
.
此命令将打印消息user is not a member of the group
或user is a member of the group
.
回答by Martin Turjak
Answer suggested by @Stacy Simpson:
@Stacy Simpson 建议的答案:
We are struggling with the issue described in these threads and none of the resolutions seem to work:
我们正在努力解决这些线程中描述的问题,但似乎没有一个解决方案有效:
- Stop "developer tools access needs to take control of another process for debugging to continue" alert
- Authorize a non-admin developer in Xcode / Mac OS
As I'm new to SO, I cannot post in either thread. (The first one is actually closed and I disagree with the localization reasoning...)
由于我是 SO 新手,因此无法在任一线程中发帖。(第一个实际上已经关闭,我不同意本地化推理......)
Anyway, we created a work-around using AppleScript that folks may be interested in. The script below should be executed asynchronously prior to launching your automated test:
无论如何,我们使用 AppleScript 创建了一个人们可能感兴趣的变通方法。 下面的脚本应该在启动自动化测试之前异步执行:
osascript <script name> <password> &
Here is the script:
这是脚本:
on run argv
# Delay for 10 seconds as this script runs asynchronously to the automation process and is kicked off first.
delay 10
# Inspect all running processes
tell application "System Events"
set ProcessList to name of every process
# Determine if authentication is being requested
if "SecurityAgent" is in ProcessList then
# Bring this dialogue to the front
tell application "SecurityAgent" to activate
# Enter provided password
keystroke item 1 of argv
keystroke return
end if
end tell
end run
Probably not very secure, but it's the best work-around we've come up with to allow tests to run without requiring user intervention.
可能不是很安全,但这是我们提出的最好的解决方法,允许测试在不需要用户干预的情况下运行。
Hopefully, I can get enough points to post the answer; or, someone can unprotect this question. Regards.
希望我能得到足够的分数来发布答案;或者,有人可以取消保护这个问题。问候。
回答by Raj
Here is a better solution from
Mac OS X wants to use system keychain when compiling the project
这是Mac OS X 的一个更好的解决方案,
希望在编译项目时使用系统钥匙串
- Open Keychain Access.
- In the top-left corner, unlock the keychain (if it is locked).
- Choose the System keychain from the top-left corner.
- Find your distribution certificate and click the disclosure triangle.
- Double-click ‘Private key' under your distribution certificate.
- In the popup, go to the Access Control tab.
- Select ‘Allow all applications to access this item'.
- Save the changes.
- Close all windows.
- Run the application.
- 打开钥匙串访问。
- 在左上角,解锁钥匙串(如果已锁定)。
- 从左上角选择系统钥匙串。
- 找到您的分发证书并单击披露三角形。
- 双击分发证书下的“私钥”。
- 在弹出窗口中,转到访问控制选项卡。
- 选择“允许所有应用程序访问此项目”。
- 保存更改。
- 关闭所有窗口。
- 运行应用程序。
回答by Naveen Kansara
I am on Snow Leopard and this one didn't quite work for me. But the following procedure worked:
我在 Snow Leopard 上,这个对我来说不太合适。但以下程序有效:
- First added another account with admin privileges by ticking "Allow user to administer this computer" under Accounts, for example an account with username test
- Logged into the testaccount
- Launched Xcode, compiled and ran my iPhone project. All ok, no errors were thrown related to permissions
- Logged out of the testaccount
- Logged in with the another account having admin privileges
- Took away the admin priviliges from the testaccount by removing the tick from "Allow user to administer this computer" under Accounts
- Logged back into the testaccount
- Deleted the iPhone project directory and again checked out from the repository (in my case svn)
- Launched Xcode, compiled and ran the project. I didn't get any errors and the App ran well in the iPhone Simulator.
- 首先通过在帐户下勾选“允许用户管理此计算机”添加另一个具有管理员权限的帐户,例如用户名test的帐户
- 登录测试账号
- 启动 Xcode,编译并运行我的 iPhone 项目。一切正常,没有抛出与权限相关的错误
- 登出测试账号
- 使用具有管理员权限的另一个帐户登录
- 好像从管理员特权时测试账号通过去除勾选“允许用户管理这台电脑”帐户下
- 重新登录到测试帐户
- 删除了 iPhone 项目目录并再次从存储库中签出(在我的情况下为 svn)
- 启动 Xcode,编译并运行项目。我没有收到任何错误,该应用程序在 iPhone 模拟器中运行良好。
回答by timofei7
After you run:
运行后:
sudo dscl . append /Groups/_developer GroupMembership <username>
per the answer above, you may stillget prompted to enter in your own password:
根据上面的答案,您可能仍会收到输入您自己的密码的提示:
We need authorization from an admin user to run the debugger. This will only happen once per login session.
我们需要管理员用户的授权才能运行调试器。每个登录会话只会发生一次。
What it really means is any _developergroupmember user so just your non-admin user/password will work here but to get rid of it completely (no prompts after a reboot) you'll also need to run:
它真正的意思是任何_developergroupmember 用户,所以只有您的非管理员用户/密码可以在这里工作,但要完全摆脱它(重新启动后没有提示),您还需要运行:
sudo DevToolsSecurity -enable
(running it with sudo as an admin user/as root will make it so you can do it remotely without a gui password prompt)
(使用 sudo 作为管理员用户/作为 root 运行它将使您可以在没有 gui 密码提示的情况下远程执行此操作)
回答by Mike Gledhill
For me, I found the suggestion in the following thread helped:
对我来说,我发现以下线程中的建议有所帮助:
It suggested running the following command in the Terminalapplication:
它建议在终端应用程序中运行以下命令:
sudo /usr/sbin/DevToolsSecurity --enable