Skip to content

Instantly share code, notes, and snippets.

@mmdock
Created April 29, 2019 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmdock/eac9012de275418b3e6a213774dd4ca6 to your computer and use it in GitHub Desktop.
Save mmdock/eac9012de275418b3e6a213774dd4ca6 to your computer and use it in GitHub Desktop.
simple script to setup a new environment for Xcode (with maybe an existing repo)
xcode-select --install
which -s brew
if [[ $? != 0 ]]; then
# Install Homebrew
sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "installed Homebrew"
else
sudo brew update
echo "Homebrew installed"
fi
which -s bundle
if [[ $? != 0 ]]; then
# Install Bundler
sudo brew install bundler
echo "installed Bundler"
else
# update
echo "Bundler installed"
fi
test -f Gemfile
if [[ $? != 0 ]]; then
# Install Gemfile
bundle install
echo "installed Gemfile"
else
echo "no Gemfile to install"
fi
which -s pod
if [[ $? != 0 ]]; then
# Install Cocoapods
sudo gem install cocoapods
pod repo update
echo "installed cocoapods"
else
# If pod was included in
pod repo update
echo "Cocoapods installed"
fi
test -f Podfile
if [[ $? != 0 ]]; then
# Install Bundler
pod install
echo "installed cocoapods's pods"
else
# If Pofile wasn't included
echo "Podfile not found"
fi
which -s carthage
if [[ $? != 0 ]]; then
sudo brew install carthage
else
echo "Carthage installed"
fi
test -f Cartfile
if [[ $? != 0 ]]; then
carthage upate
echo "Cartfile frameworks setup"
echo "Reminder: follow Carthage guides for setting up frameworks.\nSee: https://github.com/Carthage/Carthage#adding-frameworks-to-an-application for details."
else
echo "Cartfile not found"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment