Skip to content

Instantly share code, notes, and snippets.

@mattsnider
Last active February 1, 2023 22:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mattsnider/5485500 to your computer and use it in GitHub Desktop.
Save mattsnider/5485500 to your computer and use it in GitHub Desktop.
This is a shell script I use to bootstrap new dev machines (OSX) and servers (Ubuntu). It will ensure everything I need for python, node.js, and git is installed. After running bootstrap, I just need to clone my project and run the initialization script in my project to complete the setup.
#!/bin/bash
# expects python is installed with OS distribution
# single line command for execution
# wget -O - <RAW_URL> | bash
# determine environment
if hash apt-get 2>/dev/null; then
echo "Bootstrapping UBUNTU"
UBUNTU=true
# update apt-get and install a C compiler
sudo apt-get -y update && sudo apt-get -y upgrade
sudo apt-get -y install gcc
else
echo "Bootstrapping OSX"
# on OSX we use brew as the application repo
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
brew doctor
OSX=true
fi
# install python, when necessary
if [ $UBUNTU ]; then
sudo apt-get -y install python-dev python-setuptools
fi
# setup pip, virtualenv, and virtualenvwrapper
sudo easy_install pip
sudo pip install virtualenv
sudo pip install virtualenvwrapper
mkdir $HOME/.virtualenvs
# install git
if [ $UBUNTU ]; then
sudo apt-get -y install git
fi
if [ $OSX ]; then
brew install git
fi
# install node and npm
if [ $UBUNTU ]; then
sudo apt-get -y install nodejs npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
fi
if [ $OSX ]; then
brew install node npm
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment