83

Starting in MacOS Sierra, I've started to get this popup periodically from XCode, even after pressing 'Always Allow'.

Popup

I've tried deleting the "com.apple.dt.XcodeDeviceMonitor" item in Keychain. This regenerates the key, but doesn't fix the issue.

It's an open discussion topic on the Apple forums, but no one seems to have a solution.

Andrew Schreiber
  • 14,344
  • 6
  • 46
  • 53
  • Maybe a pref got messed up? Run lsof and while the dialog pops up see if Xcode has any "suspicious" looking files open. Then quit Xcode, delete the file and the key, and try again. – Colin Barrett Oct 31 '16 at 05:21
  • 1
    Does anyone know why Apple needs access to this key at all? – Florian Nov 23 '16 at 12:12

5 Answers5

104

Posting this solution for Xcode 8 because no one else has:

  1. Open Keychain Access.
  2. Search for XcodeDeviceMonitor.
  3. Drag the item to the System Keychain on left.
  4. Enter admin password.

That finally fixes it.

malhal
  • 26,330
  • 7
  • 115
  • 133
78

open [keychain access] > type "xcode" in the search area > double click [com.apple.dt.XcodeDeviceMonitor] > click [access control] > select the first option [allow all applications to access this item]

Don't forget to click Save Changes!

hope it helps.

Tap allow all applications to access this item, then tap Save Changes

Hobbes the Tige
  • 3,753
  • 2
  • 22
  • 21
Linc
  • 1,279
  • 12
  • 16
  • 2
    This didn't work for me. The popup came back on the next restart, and the Access Control was back to "Confirm before allowing access". Xcode and XcodeDeviceMonitor are in the "Always allow access by these applications" list anyway, so it shouldn't have been needed to allow all applications. – Jim Leask Nov 17 '16 at 14:18
  • Same here ... popup keeps coming back. Anyone with a permanent solution? – Z S Dec 05 '16 at 06:38
  • 1
    Did you remember to click the "Save Changes" button and type in your password? – Hobbes the Tige Jan 13 '17 at 14:46
  • 1
    When I search for `xcode` in Keychain, it doesn't find anything yet I still get this popup. ‍♂️ – Clifton Labrum May 01 '17 at 22:46
  • Maybe it's a system's bug Orz – Linc Jul 16 '17 at 12:14
  • Make sure you close the pop-up dialog box *before* opening the key chain access. If you hit "always allow" on the dialog after changing the Access Control, it resets the keychain access to "confirm before allowing access" – Thunk Sep 03 '17 at 21:48
  • Ditto. Saved changes. Still comes back. Also noticed that if I toggle between Attributes and Access control after saving, the apps disappear. So there's something strange going on. – Mike Critchley Nov 23 '17 at 06:21
  • 1
    Update. I think the only solution that permanently gets rid of the pop up is the solution below by malhal...haven't seen the pop up since, even after a restart and intentionally crashing my app with an array out of bounds exception. Still, learned something from this answer to for future reference. Thanks. – Mike Critchley Nov 23 '17 at 10:40
  • Works like a charm! – Patrick Bodet Dec 24 '17 at 11:40
  • This works temporarily. But the issue with this approach is that this the key gets deleted when you close Xcode and re-created with the default settings, when you open Xcode again. – Adrian Schönig Mar 10 '18 at 10:09
11

The following worked for me (running macOS 10.12.1 and XCode 7.3).

Note that the problem with other solutions is that they operate on the (temporary) login keychain entry, which is removed when XCode quits, so a solution appears to be to create the entry in the System keychain instead.

I tried using Keychain Access to move the entry from the login to the System keychain but it failed with various obscure errors (e.g. "An error has occurred. Unable to add an item to the current keychain")

Instead, I used the security command to create a new entry in the System keychain that's (almost) identical to the temporary one.

The only difference is the password which I couldn't be bothered to extract (and I'm unsure whether it's important).

Open Terminal, paste and execute the following command (after suitable editing if XCode isn't in the normal location):

sudo security add-generic-password \
-s 'com.apple.dt.XcodeDeviceMonitor' \
-a session-token \
-p anyoldstring \
-T /Applications/Xcode.app \
-T /Applications/Xcode.app/Contents/Developer/Library/Xcode/Tools/XcodeDeviceMonitor \
/Library/Keychains/System.keychain

Disclaimer - my sole objective here was to prevent the annoying alert.
I've no idea whether this will break anything.
You're messing with the System keychain: what could possibly go wrong ?

peegee123
  • 231
  • 1
  • 4
  • 4
  • 1
    This worked while no other solution did. I had to modify the file paths slightly, since my Xcode is in a folder called Xcode, but otherwise this has worked! Thanks. – Andrew Smith Feb 06 '17 at 23:04
1

I reported this to Apple as a bug and after several suggestions the same as some of those mentioned here that didn't work they came back with the following, which has worked:

"Sorry about the trouble. We’ll dig a bit more into this. In the mean time, if you don’t need the iCloud gauge, you can temporarily disable it by doing this:

  1. Go to Terminal.app.
  2. Type this in to enable an User Defaults
    defaults write com.apple.dt.Xcode iCloudGaugeDisabled -bool YES
  3. Relaunch Xcode "
Easiwriter
  • 53
  • 6
0

This issue has popped up again for me this past fall. I think the issue may stem from the security hole that apple had where the root user account was left un password protected. I reset my password for the root user account (to the same password as it was previously). I didn't notice the relationship at the time, but after reading this support item, I suspected that this could be the issue.

https://support.apple.com/en-us/HT201609

I reset my password for the login keychain (again to the same password) following these steps and the issue has since gone away.

Hope this helps.

johnrechd
  • 1,801
  • 19
  • 25