This is a quick guide on how to set up your environment variables on macOS after installing Android Studio.
Zsh Setup
- Create or open your
.zshrc
file:
touch ~/.zshrc; open ~/.zshrc
- Insert the following lines into the opened
.zshrc
file:
# Set the JAVA_HOME variable to the location of Android Studio's embedded JDK
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home
# Add Android SDK platform-tools to the PATH
export PATH="$HOME/Library/Android/sdk/platform-tools:$PATH"
- Optional: Verify the Android SDK Path (modify if necessary):
# Make sure to update the path below if your Android SDK is located in a different directory
export PATH="$HOME/path/to/your/Android/sdk/platform-tools:$PATH"
- Apply changes immediately by sourcing the
.zshrc
file:
source ~/.zshrc