본문 바로가기

English/Google Analytics 4 (GA4)

ADB Environment Setup Guide for MacBook

ADB Environment Setup Guide for MacBook

Setting up the ADB environment is a one-time task, but having a guide can be helpful when setting up a new laptop or sharing instructions with others. Here's a detailed guide for reference.

 

 


 

1. Check the Current Shell

Run the following command in the terminal:

echo $SHELL

 

Example results:

  • /bin/zsh: You are using Zsh.
  • /bin/bash: You are using Bash.

In my case, I'm using /bin/zsh

 

2. Determine the Correct Configuration File

The file to edit depends on the shell you are using:

    • Zsh: Use ~/.zshrc.
    • Bash:  Use ~/.bashrc and ~/.bash_profile.

 

3. Edit the Configuration File

(1) For Zsh (echo $SHELL result is /bin/zsh):

Open the Zsh configuation file.

vi ~/.zshrc

 

Tip: To start editing, press 'i' on your keyboard. This switches the editor to 'insert mode', allowing you to add lines.

 

#Android SDK Platform-Tools path setup
export ADB_HOME=/Users/jiheeyoo/Library/Android/sdk/platform-tools
export PATH=${ADB_HOME}:$PATH

 

Tip - Once you're done, press ESC to exit 'insert mode', then type :wq and press Enter to save and close the file.

 

(2) For Bash (echo $SHELL result is /bin/bash):

  • Open the Bash configuration file:
# Android SDK Platform-Tools path setup 
export ADB_HOME=/Users/jiheeyoo/Library/Android/sdk/platform-tools 
export PATH=${ADB_HOME}:$PATH
  • Open ~/.bash_profile and add the following lines to load .bashrc:
vi ~/.bash_profile
# Load .bashrc if it exists
if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi

 

4. Apply the Changes

To apply the changes, run the appropriate command

  • Zsh
source ~/.zshrc

 

  • Bash
source ~/.bash_profile

 

5. Open a New Terminal Session

Open a new terminal window to ensure the settings persist.

 

6. Verify the PATH and Test ADB

  1. Check if the Android SDK path is included - The output should include /Users/jiheeyoo/Library/Android/sdk/platform-tools
  2. Verify that ADB is working - If ADB version details are displayed, the setup is complete.

 

 

 
With this setup, you no longer need to run the source command each time to use ADB. This guide is also useful when setting up a new laptop or providing clear instructions to others. 😊