Setting Up a Unified Development Environment for Mobile Projects Using Homebrew, rbenv, RubyGems, Bundler, and Flutter Wrapper
This guide explains how mobile developers can create a consistent, project‑level development environment by using Homebrew for package management, rbenv for Ruby version control, RubyGems and Bundler for dependency handling, and flutter‑wrapper to standardize Flutter SDK usage across the team.
Mobile developers often face version inconsistencies when multiple people or departments work on the same iOS or Android project, leading to Git conflicts, difficult onboarding, and permission issues. A unified configuration stored as plain‑text files in Git solves these problems by allowing every developer to reproduce the same environment.
What is unified configuration? It means keeping all configuration files in a Git repository so that changes are tracked, differences can be compared, and any developer can set up an identical environment.
Homebrew common commands
Search for a package: brew search git Install a package: brew install git List installed packages: brew list Uninstall a package: brew uninstall git Show package info: brew info git Update Homebrew: brew update Homebrew manages OS‑level packages, while gem manages Ruby libraries.
Building a unified environment
iOS development relies on a specific Xcode version, which should be noted in the project’s README. Ruby version management is handled by rbenv: brew install rbenv ruby-build rbenv-vars After installation, add the following to ~/.bash_profile or ~/.zshrc so that rbenv initializes on each terminal start:
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"Reload the profile: source .zshrc Set the project’s Ruby version:
cd $(PROJECT_DIR)
rbenv install 2.7.1
rbenv local 2.7.1The .ruby-version file created by rbenv can be committed to Git, ensuring all developers use the same Ruby version.
RubyGems and Bundler
Install Bundler: gem install bundler Initialize a Gemfile in the project directory: bundle init Specify required gems (e.g., Cocoapods and fastlane):
source "https://rubygems.org"
gem "cocoapods", "1.12.0"
gem "fastlane", "2.189.0"Install the gems and lock their versions: bundle install Commit both Gemfile and Gemfile.lock to Git. When using these tools, invoke them through Bundler to guarantee the project‑level versions, e.g., bundle exec pod install.
Flutter wrapper (flutterw)
Download the wrapper script and make it executable:
curl -O https://raw.githubusercontent.com/zakiso/flutterw/master/flutterw && chmod 755 flutterwInitialize the wrapper in the project: ./flutterw init This creates flutter_wrapper.properties containing the current Flutter SDK version; the wrapper then ensures every team member uses that version, storing the SDK under ${HOME}/flutter_wrapper/{version} if not already present.
Alias shortcuts
Add frequently used command aliases to ~/.bash_profile (or source it from .zshrc):
# git
alias gck='git checkout'
alias gm='git merge'
alias gb='git branch'
alias gbr='git branch -a'
alias gs='git status'
alias gc='git clone'
alias gl='git log'
alias ga='git add .'
alias gpull='git pull'
alias gpush='git push'
alias gcm='git commit -m'
# pod
alias pru='pod repo update'
alias pi='pod install'
alias pu='pod update'
# iOS simulator
alias iOSSimulator='open -a Simulator'
# open with Safari
alias OpenWithSafari='open -a "/Applications/Safari.app" 'If .bash_profile does not exist, create it and edit:
touch .bash_profile
vim .bash_profileAfter editing, apply the changes with: source ~/.bash_profile For iTerm2 users who rely on .zshrc, source the Bash profile from the Zsh configuration: source ~/.bash_profile This approach keeps the original Bash profile untouched while isolating alias definitions, simplifying the management of a unified development environment across macOS terminals.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
360 Smart Cloud
Official service account of 360 Smart Cloud, dedicated to building a high-quality, secure, highly available, convenient, and stable one‑stop cloud service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
