Skip to content

Instantly share code, notes, and snippets.

@geta6
Created September 18, 2019 01:39
Show Gist options
  • Save geta6/c1aeb29755e107122eb8bba67bb06583 to your computer and use it in GitHub Desktop.
Save geta6/c1aeb29755e107122eb8bba67bb06583 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Create missing home directories
[[ ! -d ~/Developer ]] && mkdir ~/Developer
[[ ! -d ~/Sites ]] && mkdir ~/Sites
# Install homebrew
if [ ! -x "`which brew`" ]; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Homebrew formulae
echo '> Install Homebrew Formulae'
brew install \
openssl \
readline \
yarn \
git \
hub \
tig \
htop \
the_silver_searcher \
tmux \
mysql \
redis
# Homebrew casks
echo '> Install Homebrew Casks'
brew cask install \
figma \
firefox \
google-chrome \
gyazo \
slack \
visual-studio-code
# Install missing header files
if [ -d "/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg" ]; then
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
fi
# Export configuration options
if [ -x "`which brew`" ]; then
export CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)"
fi
# Create ssh
if [ ! -d ~/.ssh ]; then
mkdir -p ~/.ssh
chmod 700 ~/.ssh
fi
# Node.js
if [ ! -d ~/.nodenv ]; then
git clone https://github.com/nodenv/nodenv.git ~/.nodenv && cd ~/.nodenv && ./src/configure && make -C src
fi
if [ ! -d ~/.nodenv/plugins/node-build ]; then
git clone https://github.com/nodenv/node-build.git ~/.nodenv/plugins/node-build
fi
if [ ! -d ~/.nodenv/plugins/nodenv-update ]; then
git clone https://github.com/nodenv/nodenv-update.git ~/.nodenv/plugins/nodenv-update
fi
if [ ! -d ~/.nodenv/plugins/node-build-update-defs ]; then
git clone https://github.com/nodenv/node-build-update-defs.git ~/.nodenv/plugins/node-build-update-defs
fi
# Ruby
if [ ! -d ~/.rbenv ]; then
git clone https://github.com/rbenv/rbenv.git ~/.rbenv && cd ~/.rbenv && ./src/configure && make -C src
fi
if [ ! -d ~/.rbenv/plugins/ruby-build ]; then
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
fi
if [ ! -d ~/.rbenv/plugins/rbenv-update ]; then
git clone https://github.com/rkh/rbenv-update.git ~/.rbenv/plugins/rbenv-update
fi
# Install versions
source ~/.zpreztorc
if [ ! -x "`which nodenv`" ]; then
export PATH="$HOME/.nodenv/bin:$HOME/.nodenv/shims:$PATH"
eval "$(nodenv init -)"
fi
nodenv update-version-defs
nodenv install -s 12.10.0
nodenv global 12.10.0
nodenv rehash
if [ ! -x "`which rbenv`" ]; then
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
eval "$(rbenv init -)"
fi
rbenv install -s 2.6.3
rbenv global 2.6.3
rbenv rehash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment