A message like ZSH: Command not found: adb is sometimes displayed when you run the ADB command on MacOS to view information about an Android device that is currently connected to the PC. The solutions are as follows:
Check whether the system is correctly configured with the environment variables related to Android development
You can run the vim ~/. Bash_profile command on MacOS to open the configuration file of the system and add the configuration of environment variables related to Android development to the file. The specific configuration is as follows:
export ANDROID_HOME=/Users/youruser/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/emulator
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
export PATH=${PATH}:${ANDROID_HOME}/build-tools
Copy the code
ANDROID_HOME is the specific path where the Android SDK is located on your computer. You can configure it according to your own actual path. The other configuration items can be copied and pasted completely.
If you haven’t already downloaded the Android SDK, you can download it from the Android Development Tools download site by clicking this link.
2. Enable Android environment variables
After adding android-related environment variables to the ~/.bash_profile file, you can run the source ~/.bash_profile command to make the modified.bash_profile take effect.
3. Check whether the Android environment variables are configured successfully
After running the source ~/.bash_profile command, enter ADB –version on the terminal and run the command. Adb version information is displayed.
Android Debug Bridge version 1.0.41
Version 31.0.2-7242960
Installed as /Users/youruser/Library/Android/sdk/platform-tools/adb
Copy the code