Adb is a command line tool that can interact with Android devices and perform common operations such as installing or uninstalling apps, opening apps, and viewing app logs.
Android Debug Bridge (ADB)
Here are a few ways to install ADB on a MAC.
1. Use the Android SDK to configure environment variables
The IDE for Android development is Android Studio. During the process of downloading and installing Android Studio, you will download the SDK by yourself. The SDK will include adb environment, as shown in the SDK file path /platform-tools/ ADB.
After the Android SDK is downloaded, you need to configure the corresponding environment variables. Take ZSH as an example.
# Android Sdk
export ANDROID_HOME=~/Documents/develop/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
export PATH=${PATH}:${ANDROID_HOME}/tools/bin
export PATH=${PATH}:${ANDROID_HOME}/emulator
export ANDROID_SDK=${ANDROID_HOME}
export ANDROID_NDK=${ANDROID_HOME}/ndk-bundle
Copy the code
ANDROID_HOME is the path where my SDK is located and ${ANDROID_HOME}/platform-tools is the environment variable associated with ADB.
Once configured, close and restart the terminal for the ADB environment to take effect.
Of course, if you don’t want to develop an Android app, you can use another convenient method.
To download the IDE, go to Android Studio
2. Install via Homebrew
If you have Homebrew on your computer, you can quickly install it by using the following command, which will not be described here.
brew install --cask android-platform-tools
Copy the code
After the installation is complete, shut down and restart the terminal for the ADB environment to take effect.
3. Download the platform-tools package and configure environment variables
This is the simplest way, and it applies to most students.
Download address: SDK Platform Tools version description
Download the corresponding version here:
Once the download is complete, unzip the file (put it in a directory that doesn’t change often to avoid accidentally deleting it) and configure environment variables for the file. Again, using my ZSH configuration as an example, I put the platform-tools folder under my Downloads directory.
Adb: export PATH=${PATH}:~/Downloads/platform-toolsCopy the code
Once configured, close and restart the terminal for the ADB environment to take effect.
Verify that the installation is successful
Adb –version can be used to verify that the ADB environment is configured:
$adb --version Android Debug Bridge version 1.0.41 version 31.0.3-7562133 Installed as /Users/xxx/Downloads/platform-tools/adbCopy the code
As you can see, the adb installation path is the configured path.
Common commands
Adb common commands Go to ADB common commands