17

When I running an application shared extension from XCode run button and then trying to share files, XCode shows the below error frequently. Anyone have any idea whats causing it?

enter image description here

Error: "cannot attach to process due to System Integrity Protection"

Dan Rosenstark
  • 68,471
  • 58
  • 283
  • 421
Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256
  • 1
    Not a duplicate but also see https://stackoverflow.com/questions/8708417/instruments-cant-attach-to-running-process-on-iphone/53272592#53272592 for Instruments issues. – Dan Rosenstark Nov 13 '18 at 01:49

3 Answers3

18

System Integrity Protection(SIP) aka rootless is a new security feature in OS X 10.11. By default it disables even the administrator to access/modify the root. Follow these steps to disable SIP:

  1. Restart your Mac.

  2. Before OS X starts up, hold down Command-R and keep it held down until you see an Apple icon and a progress bar. Release. This boots you into Recovery.

  3. From the Utilities menu, select Terminal.

  4. At the prompt type exactly the following and then press Return:

     csrutil disable
    
  5. Terminal should display a message that SIP was disabled.

  6. From the  menu, select Restart.

You can re-enable SIP by following the above steps, but using csrutil enable instead.

Community
  • 1
  • 1
Yash Tamakuwala
  • 1,789
  • 1
  • 24
  • 33
7

In some cases, if you are trying to connect to a "system provided" executable (for example, Terminal.app) there is a workaround by making a copy of such executable. The copy will be checked by SIP as "user installed" instead of "system provided".

For an example, see "Launching the Terminal app from Xcode on OS X with System Integrity Protection"

marc-medley
  • 8,931
  • 5
  • 60
  • 66
0

Sometimes I also get this error on Xcode while trying to run an app on simulator. Usually I only run the app again, and at most I restart the simulator, and it solves the problem.

Be aware of the security risks you're incurring on disabling SIP (System Integrity Protection): https://support.apple.com/en-us/HT204899

Ricardo Barroso
  • 634
  • 9
  • 11