Mobile Development 8 min read

Step-by-Step Guide to Setting Up a macOS Mobile Development Environment for Android and Flutter

This article provides a comprehensive, beginner-friendly walkthrough for configuring a macOS machine with Android Studio, Flutter SDK, Homebrew, Vim, CocoaPods, and iOS simulators, including detailed commands, environment variable tweaks, and troubleshooting tips to get Flutter projects running on iOS devices.

Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Step-by-Step Guide to Setting Up a macOS Mobile Development Environment for Android and Flutter

Introduction

Hello, I am Weiyang Ge, a modest mobile development practitioner. After reformatting my computer, I documented the entire setup process as a "cookbook" for future reference and for anyone else who might need it.

Required Software Installation

Android Studio

No special remarks; download Android Studio or VSCode according to personal preference.

Sidekick

Flutter SDK management tool.

After installation, select the desired Flutter version, download it, and set it as global.

Environment Configuration

Check Which Shell Is Used (Bash or Zsh)

Run echo $SHELL in the terminal; it will display the path of the default shell.

If the output is /bin/bash , you are using Bash; if /bin/zsh , you are using Zsh.

On my Mac the result is /bin/bash .

Verify Homebrew Installation

Run brew doctor . If you see brew: command not found , Homebrew is not installed.

Install it with: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

After installation, run brew doctor again; you should see your system is ready to brew .

If the command is still not found, add Homebrew to your PATH: echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile # for Bash echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc # for Zsh

Homebrew may output a long success message; follow the final instructions to add its environment to your profile: (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/10583/.bash_profile eval "$(/opt/homebrew/bin/brew shellenv)"

Restart the terminal and run brew doctor again to confirm.

Common Homebrew Issues

If updates hang at "Cloning into…", run: cd /usr/local/Homebrew/Library/Taps/ mkdir homebrew cd homebrew git clone https://mirrors.ustc.edu.cn/homebrew-core.git # or the cask repo brew update

If you encounter a missing formula.jws.json file, add the environment variable export HOMEBREW_NO_INSTALL_FROM_API=1 to your profile.

Check Vim Installation

Run vim ~/.bash_profile . If you get vim: command not found , install Vim with brew install vim .

Modify Environment Variables

Open the profile file with vim ~/.bash_profile and press i to enter insert mode.

Add the following lines for Flutter and proxy settings: # Flutter # Flutter SDK location export PATH=$HOME/fvm/default/bin:$PATH # Flutter network proxy export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

Press Esc , then type :wq to save and quit (use :wq! if the file is read‑only).

Apply the changes with source ~/.bash_profile and verify by running flutter --version .

Install CocoaPods

Run brew install cocoapods .

Verify the installation with pod --version .

Running on an iOS Simulator

Create an iOS Simulator

Install Xcode from the App Store.

Open Xcode, go to Window → Devices and Simulators , then select the Platforms tab to download the required iOS resources.

Open the Simulator from Xcode and choose a device model to launch.

Run a Flutter Project on the iOS Simulator

If you see an error about the deployment target, open Runner.xcworkspace in Xcode and set the iOS Deployment Target to 13.0 .

Also edit the Podfile and set platform :ios, '13.0' .

Navigate to the iOS directory and run pod install .

After these adjustments, the Flutter project should run on the simulator; any remaining issues can be posted in the comments for further help.

Conclusion

If you are interested in Android or Flutter, consider subscribing to my columns:

Android Knowledge

Flutter

Flutter Q&A Collection

Thank you for your support; writing is hard, so please point out any mistakes, like, follow, and bookmark the article.

FluttermacOSandroid-studioDevelopment SetupHomebrewiOS Simulator
Rare Earth Juejin Tech Community
Written by

Rare Earth Juejin Tech Community

Juejin, a tech community that helps developers grow.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.