Skip to content

Instantly share code, notes, and snippets.

@minuz
Created March 24, 2023 11:54
Show Gist options
  • Select an option

  • Save minuz/2595ffe63441b532e56aa01fa79a4017 to your computer and use it in GitHub Desktop.

Select an option

Save minuz/2595ffe63441b532e56aa01fa79a4017 to your computer and use it in GitHub Desktop.
Setup-mobile-dev-mac.sh
#!/bin/bash
# Check for Homebrew and install if not found
if test ! $(which brew); then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo "Updating Homebrew..."
brew update && brew upgrade
fi
# Install Node.js and npm using nvm if nvm is not already installed
if test ! $(which nvm) && [ ! -d "$HOME/.nvm" ]; then
echo "Installing nvm..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
fi
source ~/.nvm/nvm.sh
echo "Installing Node.js..."
nvm install 16
nvm install --lts
# Install Yarn package manager
if test ! $(which yarn); then
echo "Installing Yarn..."
brew install yarn
fi
# Install Watchman
if test ! $(which watchman); then
echo "Installing Watchman..."
brew install watchman
fi
# Install Xcode command line tools
if test ! $(xcode-select -p); then
echo "Installing Xcode command line tools..."
xcode-select --install
fi
# Install CocoaPods using Homebrew
if test ! $(which pod); then
echo "Installing CocoaPods..."
brew install cocoapods
fi
# Check if Android Studio is installed
if test ! $(which studio) && [ ! -d "/Applications/Android Studio.app" ]; then
echo "Installing Android Studio..."
brew install android-studio
fi
echo "Setup complete!"
# Install Chocolatey if not already installed
if (!(Get-Command choco -ErrorAction SilentlyContinue)) {
Write-Output "Chocolatey not found, installing..."
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 # TLS 1.2 or later
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
# Install nvm for Windows and use it to install Node.js versions
choco install nvm -y
$env:NVM_SYMLINK = "C:\Program Files\nodejs"
$env:NVM_HOME = "C:\Program Files\nvm"
nvm install 16
nvm install --lts
# Install Python 2 and set environment variable
choco install python2 -y
[Environment]::SetEnvironmentVariable("PYTHON", "C:\Python27\python.exe", "User")
# Install JDK, Android SDK, and set environment variables
choco install javaruntime android-sdk -y
[Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Java\jdk1.8.0_301", "User")
[Environment]::SetEnvironmentVariable("ANDROID_HOME", "$env:USERPROFILE\AppData\Local\Android\Sdk", "User")
[Environment]::SetEnvironmentVariable("Path", "$env:Path;$env:ANDROID_HOME\tools;$env:ANDROID_HOME\platform-tools", "User")
# Install Chocolatey GUI
choco install chocolateygui -y
# Install React Native CLI and CocoaPods
npm install -g react-native-cli
gem install cocoapods
Write-Output "Setup complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment