Last active
April 15, 2023 13:37
-
-
Save fahmyfarahat/5ea70825c9b564dfde5c57605d49a7fc to your computer and use it in GitHub Desktop.
Automated React Native environment setup and project creation script for macOS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Update package lists | |
echo "Updating package lists..." | |
brew update | |
# List of necessary packages | |
packages=("node" "watchman" "python3" "make" "gcc" "git" "ruby" "bash" "curl") | |
# Install packages if they are not already installed | |
for package in "${packages[@]}"; do | |
if ! brew list --formula $package >/dev/null 2>&1; then | |
echo "Installing $package..." | |
brew install $package | |
fi | |
done | |
# Install CocoaPods based on its presence | |
echo "Installing CocoaPods..." | |
sudo gem install cocoapods | |
# Ensure pip, setuptools, and wheel are installed and up-to-date | |
echo "Ensuring pip, setuptools, and wheel are installed and up-to-date..." | |
python3 -m ensurepip | |
python3 -m pip install --no-cache --upgrade pip setuptools wheel | |
#install global react-native-cli if exists | |
echo "Installing global react-native-cli..." | |
npm install -g react-native-cli | |
# Clear npm cache | |
echo "Clearing npm cache..." | |
npm cache clean --force | |
# Set up a new React Native project | |
echo "Setting up a new React Native project..." | |
read -p "Enter the name of your React Native project: " project_name | |
npx react-native init $project_name | |
# Change to the project directory | |
cd $project_name | |
# Run the React Native app on iOS | |
echo "Running the React Native app on iOS..." | |
npx react-native run-ios |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script helps you set up a new React Native project on macOS by automating the installation of necessary dependencies and creating a new project. It also runs the app on iOS for the first time.
Usage:
chmod +x setup_react_native.sh
../setup_react_native.sh
.