alexcmgit

This post assumes Flutter, Android SDK, and asdf are already installed on your system.

Here we only wire your shell so everything works together consistently.

If you are starting from absolute zero, follow the individual guides first:

  • Installing asdf from scratch on macOS
  • Installing Flutter with asdf on macOS
  • Installing Android Studio and Android SDK on macOS

Those posts cover fresh installs and first-time setup. This article is only the glue layer that connects everything through Zsh.

If you are not sure where your Android SDK is located, read this companion post first:

How to find your Android SDK path

You will need that path for the Android exports below.

The goal here:

  • Make asdf shims available globally
  • Expose Flutter’s root directory
  • Enable asdf Zsh completions
  • Add Android SDK tools (adb, emulator) to your PATH
  • Allow globally activated Dart CLI tools to run from the terminal

All changes live in ~/.zshrc.

Important

You must append the configuration below to your existing ~/.zshrc.

Do NOT delete or replace the file.

Most developers already have aliases, exports, themes, or other tooling in there. You are only adding a new block at the bottom (or near similar exports).

Replacing the whole file will break your shell setup.

Add the variables to ~/.zshrc

Open your config:

nano ~/.zshrc

Scroll to the bottom and append this block:

# ASDF
export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"

# Flutter
export FLUTTER_ROOT="$(asdf where flutter)"

# Dart global executables (dart pub global activate)
export PATH="$HOME/.pub-cache/bin:$PATH"

# append completions to fpath
fpath=(${ASDF_DATA_DIR:-$HOME/.asdf}/completions $fpath)
# initialise completions with ZSH's compinit
autoload -Uz compinit && compinit

# Android SDK
export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
export PATH=~/Library/Android/sdk/emulator:$PATH

If your Android SDK is not in ~/Library/Android/sdk, replace that path with the one you discovered in the SDK-path post above.

Save, then reload:

source ~/.zshrc

What each variable does

asdf shims

export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"

Makes every asdf-managed tool available globally.

Without this, asdf global flutter has no effect on your shell.

Flutter root

export FLUTTER_ROOT="$(asdf where flutter)"

Exposes Flutter’s real installation directory.

Some build scripts and integrations rely on FLUTTER_ROOT, especially on Android pipelines.

Dart global binaries

export PATH="$HOME/.pub-cache/bin:$PATH"

Allows executables installed with:

dart pub global activate <package>

to run directly from your terminal.

Many Dart and Flutter CLI tools install scripts into the pub cache. Without this export, commands installed via dart activate will not be found by your shell.

Example:

dart pub global activate melos
melos --version

If the command runs successfully, your Dart global tools are correctly configured.

asdf Zsh completions

fpath=(${ASDF_DATA_DIR:-$HOME/.asdf}/completions $fpath)
autoload -Uz compinit && compinit

Enables tab completion for asdf commands.

Optional, but nice.

Android SDK paths

export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
export PATH=~/Library/Android/sdk/emulator:$PATH

These expose:

  • adb
  • emulator
  • legacy SDK tools

Again, adjust ~/Library/Android/sdk if your SDK lives elsewhere.

Quick validation

Run:

which flutter
which adb
which emulator
which melos
echo $FLUTTER_ROOT

Each command should return a valid path.

Finally:

flutter doctor

If Flutter detects Android and no binaries are missing, your environment variables are correctly configured.

That’s it.

Use the separate posts for full clean installations. This one exists purely to connect everything together once the tools are already on your machine.

Other posts

you reached the end
CC BY-NC-SA 4.0 v35865c4 2021-2026 @alexcmgit