skip to Main Content

I am having a problem with the execution of Android Debug Bridge (ADB) on my macOS device. Every time I try to run ADB from the command line, I get an ‘Operation Not Permitted’ error. This happens even if I attempt to run the command using ‘sudo’.

Here’s what I get:

$ adb
zsh: operation not permitted: adb
$ adb devices
zsh: permission denied: adb

I am running macOS 12.6.1. Any advice or insights on how to solve this issue would be greatly appreciated!

I’ve verified that ADB is indeed present at the path:

$ which adb
/Users/my_username/Library/Android/sdk/platform-tools/adb

I have also tried changing permissions for the ADB file:

$ chmod +x /Users/my_username/Library/Android/sdk/platform-tools/adb

But that didn’t resolve the issue. I have given full disk access to Terminal from my Security & Privacy settings.

Additionally, reinstalling the Android SDK did not solve the issue, nor did disabling Gatekeeper temporarily using sudo spctl --master-disable.

Interestingly, when I run ‘flutter doctor’, I get the following error:

[☠] Connected device (the doctor check crashed)
✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
✗ Exception: The flutter tool cannot access the file or directory.

2

Answers


  1. Chosen as BEST ANSWER

    I resolved the issue. It was caused by Cylance, a security software installed on my company computer, which was blocking ADB. After speaking with my supervisor, the settings in Cylance were updated to allow Android Studio and ADB to run.


  2. It may be that macOS has applied a quarantine extended attribute to the the adb executable that is part of the Android SDK.

    Find the full path to adb script in your Android SDK installation. You can do this using which adb. It will normally be within the platform tools folder which is within your $ANDROID_HOME directory.

    Check if extended attributes have been applied to the executable:

    xattr -l PATH/TO/ADB

    If com.apple.quarantine is present in the list of attributes displayed then you need to remove it before macOS will let you run that executable.

    You can do this using:

    xattr -d com.apple.quarantine PATH/TO/ADB

    Note that this same issue can occur with any bash script including new ones that you may write as part of your general workflow, CI scripts etc. I just ran into this on Ventura for a simple script to clean my development environment.

    One last step is to ensure that the script is executable using:

    chmod +x PATH/TO/AFFECTED-SCRIPT.SH

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search