Authorize a non-admin developer in Xcode / Mac OS

XcodeMacosOsx Snow-LeopardPrivilegesDscl

Xcode Problem Overview


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:

"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.

What is the best way around this?

Xcode Solutions


Solution 1 - Xcode

You need to add your macOS user name to the _developer group. See the posts in this thread for more information. The following command should do the trick:

sudo dscl . append /Groups/_developer GroupMembership <username>

Solution 2 - Xcode

Finally, I was able to get rid of it using DevToolsSecurity -enable on Terminal. Thanks to @joar_at_work!

FYI: I'm on Xcode 4.3, and pressed the disable button when it launched for the first time, don't ask why, just assume my dog made me do it :)

Solution 3 - Xcode

$ dseditgroup -o edit -u <adminusername> -t user -a <developerusername> _developer

Solution 4 - Xcode

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:

sudo dscl . append /Groups/<group> GroupMembership <username>

I believe the name for the DevTools group is _developer.

Solution 5 - Xcode

Ned Deily's solution works perfectly fine, provided your user is allowed to 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.

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.

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.

Solution 6 - Xcode

Answer suggested by @Stacy Simpson:

We are struggling with the issue described in these threads and none of the resolutions seem to work:

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...)

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:

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.

Solution 7 - Xcode

I am on Snow Leopard and this one didn't quite work for me. But the following procedure worked:

  1. First added another account with admin privileges by ticking "Allow user to administer this computer" under Accounts, for example an account with username test
  2. Logged into the test account
  3. Launched Xcode, compiled and ran my iPhone project. All ok, no errors were thrown related to permissions
  4. Logged out of the test account
  5. Logged in with the another account having admin privileges
  6. Took away the admin priviliges from the test account by removing the tick from "Allow user to administer this computer" under Accounts
  7. Logged back into the test account
  8. Deleted the iPhone project directory and again checked out from the repository (in my case svn)
  9. Launched Xcode, compiled and ran the project. I didn't get any errors and the App ran well in the iPhone Simulator.

Solution 8 - Xcode

For me, I found the suggestion in the following thread helped:

https://stackoverflow.com/questions/9132826/stop-developer-tools-access-needs-to-take-control-of-another-process-for-debugg

It suggested running the following command in the Terminal application:

sudo /usr/sbin/DevToolsSecurity --enable

Solution 9 - Xcode

Here is a better solution from
https://stackoverflow.com/questions/10204320/mac-os-x-wants-to-use-system-keychain-when-compiling-the-project

> 1. Open Keychain Access. 2. In the top-left corner, unlock the keychain (if it is locked).

  1. Choose the System keychain from the top-left corner.
  2. Find your distribution certificate and click the disclosure triangle.
  3. Double-click ‘Private key’ under your distribution certificate.
  4. In the popup, go to the Access Control tab.
  5. Select ‘Allow all applications to access this item’.
  6. Save the changes.
  7. Close all windows.
  8. Run the application.

Solution 10 - Xcode

After you run:

sudo dscl . append /Groups/_developer GroupMembership <username>

per the answer above, you may still get 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 _developer groupmember 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:

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)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAndrew CainView Question on Stackoverflow
Solution 1 - XcodeNed DeilyView Answer on Stackoverflow
Solution 2 - XcodechunkyguyView Answer on Stackoverflow
Solution 3 - XcodecdespinosaView Answer on Stackoverflow
Solution 4 - XcodephoebusView Answer on Stackoverflow
Solution 5 - XcodeKheldarView Answer on Stackoverflow
Solution 6 - XcodeMartin TurjakView Answer on Stackoverflow
Solution 7 - XcodeNaveen KansaraView Answer on Stackoverflow
Solution 8 - XcodeMike GledhillView Answer on Stackoverflow
Solution 9 - XcodeRajView Answer on Stackoverflow
Solution 10 - Xcodetimofei7View Answer on Stackoverflow