Skip to content

Instantly share code, notes, and snippets.

@farmisen
Forked from ThePredators/readme-mde.md
Last active October 31, 2021 02:44
Show Gist options
  • Save farmisen/e7e56d1ab447c267110f09bda8994961 to your computer and use it in GitHub Desktop.
Save farmisen/e7e56d1ab447c267110f09bda8994961 to your computer and use it in GitHub Desktop.
Setup Mobile Development Environment

⭐ Setup Mobile Development Environment (Tested on macOS M1+Intel)

Install HomeBrew

## Install xcode utils
xcode-select --install
## Install Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
## Check that everything is Ok
brew doctor
## To update HomeBrew
brew update

To update/upgrade a brew package just run :

brew reinstall PACKAGE_NAME

Since macOS Big Sur, HomeBrew path now is "/opt/homebrew" Don't forget to add this to replace line "export PATH=..." that was in .zshrc

HBP=/opt/homebrew
export PATH=$HBP/bin:$PATH

Apple M1 Support

Add this alias to .zshrc

alias brew="arch -arm64 brew"

Install ZSH

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

🔆 Configure Zsh in a clever way

Clone the following repository and follow the described steps zshconfig

⚠️⚠️ Every Time you edit .zshrc you need to open a new Tab of Terminal/iTerm ⚠️⚠️

Install PowerLvl Template + Zsh Plugins

## Install Power10k :
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
### change them in .zshrc  : ZSH_THEME="powerlevel10k/powerlevel10k"

## Install Power9k :
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
### change them in .zshrc  : ZSH_THEME="powerlevel9k/powerlevel9k"

## Install Auto-Suggestion :
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
### Edit .zshrc & add in plugins array : plugins=(zsh-autosuggestions)

## Install Syntaxe Hylight :
brew install zsh-syntax-highlighting
## Copy/Paste in .zshrc before rvm Config : source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh >> /Users/$(whoami)/.zshrc

## Install Completion : 
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
### Edit .zshrc & add in plugins : plugins=(zsh-autosuggestions)

Install Git

brew install git
brew install git-lfs

Install Git Flow

brew install git-flow

Install Sublime Text

brew install --cask sublime-text
brew install --cask fork

Install iTerm

brew install --cask iterm2

Install PowerLine Fonts for iTerm :

# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts && ./install.sh
# clean-up a bit
cd .. && rm -rf fonts

Install Ruby

Recommended using : rbenv

Globally :

  1. Install and configure rbenv
brew install rbenv

then add this 2 line to .zshrc or .bashrc

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
  1. Install ruby version 2.7.4
rbenv install 2.7.4
  1. Set Global ruby version
rbenv global 2.7.4
  1. Install latest version of bundler
gem install bundler:2.2.19 -n /usr/local/bin

Under you project :

Set local ruby version

rbenv local 2.7.4

If you need to run bundle install you need to run instead this :

bundle install --path vendor/bundle

M1 Support

Add the following to your .zshrc

alias pod="arch -x86_64 pod"
alias brew="arch -arm64 brew"
alias gem="arch -x86_64 sudo gem"

Please run the following scripts too !

gem install --user-install ffi -- --enable-libffi-alloc

More Options :

Install CocoaPods :

sudo gem install cocoapods -n /usr/local/bin

M1 Support

Add this to .zshrc

alias pod="arch -x86_64 pod"

No Need to install on macOS ! Don't forget to check the SPM Aliases !

If You develop SDK using SPM, you probably need to see this template

Install XCode

Many options to download Xcode you can use the following

Recommended Using : Xcodes

# Install xcodes
brew install robotsandpencils/made/xcodes

# list available xcode versions
xcodes list

# Install XCode
xcodes install 13 Beta 5

Before running xcodes install don't forget to add some environment variables to your .zshrc

export XCODES_USERNAME=""
export XCODES_PASSWORD=""

Others :

Install iOS Simulator :

Install xcode-install

sudo gem install xcode-install

Display all simulators By name

xcversion simulators

Install a Simulator

xcversion simulators --install="iOS 14.4 Simulator"

Display all availables devices and simulators ByIds

xcrun simctl list

Output Example :

D9C60396-FC76-4693-AEE2-84AA7C8EB200 (active, disconnected)
    Watch: Apple Watch Series 6 - 44mm (FE1A98F8-C2F2-446D-B436-B484B1D87837) (Shutdown)
    Phone: iPhone 12 Pro Max (7395B23C-9AAE-4CEB-8FCC-82A70FCE0553) (Shutdown)

Open Simualtor/Device ById

I advice to add this alias to your config :

alias sim="/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator -CurrentDeviceUDID"

Then just run :

sim D9C60396-FC76-4693-AEE2-84AA7C8EB200

(ex. From above the DeviceUDID is : D9C60396-FC76-4693-AEE2-84AA7C8EB200)

To Open latest iOS Simulator

open -a Simulator

Install SDKMAN! (optional)

curl -s "https://get.sdkman.io" | bash 
. "$HOME/.sdkman/bin/sdkman-init.sh"

Install Android (Android Studio + SDK + Java)

# Java with Homebrew
brew tap homebrew/cask-versions
brew install --cask temurin8
echo $"\nexport JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/\n" >> /Users/$(whoami)/.zshrc

# Java with SDKMAN!
sdk install java 8.0.302-tem

# Gradle 
brew install gradle
export GRADLE_HOME=/usr/local/opt/gradle
export PATH=$GRADLE_HOME/bin:$PATH

# Android platform Tools

# get download url from https://developer.android.com/studio#command-tools
mkdir -p ~/SDKs/android-sdk
cd android-sdk
wget <download_url>
unzip *.zip
rm *.zip
cd cmdline-tools
mkdir tools
mv -if * tools
# put the following in .zshrc:
export ANDROID_HOME=$HOME/SDKs/android-sdk
export PATH=$ANDROID_HOME/cmdline-tools/tools/bin/:$PATH
export PATH=$ANDROID_HOME/emulator/:$PATH
export PATH=$ANDROID_HOME/platform-tools/:$PATH

# Install latest Android SDK + Build Tools
sdkmanager --install "platform-tools" "platforms;android-31" "build-tools;31.0.0" "emulator"

More Infos :

Install Android Emulator

GenyMotion (Recomended)

brew install --cask genymotion

Usefull ClI :

## Copy this to .zshrc
echo 'GMTOOL_PATH="/Applications/Genymotion.app/Contents/MacOS/"' >> /Users/$(whoami)/.zshrc
echo 'export PATH=$GMTOOL_PATH:$PATH' >> /Users/$(whoami)/.zshrc
## Display devices list
genyshell -c "devices list"

## To Create / run u need licence !
## Create a device
gmtool admin create "Google Pixel - 9.0 - API 28 - 1080x1920" GP_9
## Run a device
gmtool admin run GP_9

Android Emulator - Apple M1

Download this emulator Apple M1

Install Android File Transfer (Optionnal)

brew install --cask android-file-transfer

Install Vysor (Optionnal)

brew install --cask vysor

Install Scrcpy (Recomended) (Vysor + Android File Transfer alternative)

brew install scrcpy

Install Flutter

## Install Flutter
brew install --cask flutter
# Instal dart
brew tap dart-lang/dart
brew install dart
## Migrate to null safety (Only inside a project)
# dart migrate --apply-changes
## Check That everythong is OK
flutter doctor

Apple M1 Support for Flutter & Docker

softwareupdate --install-rosetta
## Flutter
arch -x86_64 sudo gem install ffi

Install Fastlane

brew install fastlane

Here is a quick Tutorial on how to integrate Fastlane with TestFlight & AppCenter for Android/iOS/Flutter

Install VsCode

brew install --cask visual-studio-code

Install some macOS developer Tools

OpenInTerminal

brew install --cask openinterminal

Spectacle

brew install --cask spectacle

Dozer

brew install --cask dozer

DB Browser for SQLite

brew install --cask db-browser-for-sqlite

Proxyman

brew install --cask proxyman

PostMan

brew install --cask postman

Install Google Chrome Plugins :

You're good to go !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment