Skip to content

Instantly share code, notes, and snippets.

@Gutem
Last active July 31, 2018 04:41
Show Gist options
  • Save Gutem/546abdf20411f3f46dad to your computer and use it in GitHub Desktop.
Save Gutem/546abdf20411f3f46dad to your computer and use it in GitHub Desktop.
Shell script to automate environment installs after a vanilla OSX install
#!/bin/bash
red='\033[0;31m'
green='\033[0;32m'
NC='\033[0m' # No Color
################################################################################
# XCode CLI
################################################################################
xcode-select --install
while [[ `ps aux | grep -o "[Install] Command Line Developer Tools"` ]]; do
wait
done
################################################################################
# Homebrew
################################################################################
# Checks for Homebrew, installs if we don't have it
if test ! "$(which brew)"; then
echo -e "${green}[+] Installing Homebrew${NC}"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo -e "${green}[+] Homebrew already installed${NC}"
fi
# Checks if the ENV is okay
if [[ -n $(brew doctor | grep -o "Your system is ready to brew") ]]; then
echo -e "${green}[+] Your system is ready to Brew${NC}"
else
brew doctor
fi
# Update homebrew recipes
echo -e "${green}[+] Updating Homebrew${NC}"
brew update
# Homebrew's Taps
brew_taps=(
# Scientific repo to install R
homebrew/science
# homebrew versions
caskroom/versions
# homebrew dupes
homebrew/homebrew-dupes
)
for (( i = 0 ; i < ${#brew_taps[@]} ; i++ )) do
echo -e "${green}[+] Tapping ${brew_taps[$i]} repository${NC}"
`brew tap ${brew_taps[$i]}`
done
# Homebrew's Apps
brew_apps=(
# Caskroom repository
caskroom/cask/brew-cask
# SCM tools
bazaar
git
mercurial
subversion
# Shell
zsh
zsh-completions
# Programing languages and SDKs
android-sdk
android-ndk
ant
ghc #glasgow haskell compiler
cabal-install
R
go
python
# Version Managers
nvm
rbenv
# Databases
mongodb
mysql
postgresql
redis
sqlite
# General tools
autoenv
ffmpeg
htop-osx
httpie
imagemagick
mackup
tree
wget
spectacle
# HTTP2
nghttp2
"curl --with-nghttp2"
)
for (( i = 0 ; i < ${#brew_apps[@]} ; i++ )) do
echo -e "${green}[+] Installing ${brew_apps[$i]} ${NC}"
brew install ${brew_apps[$i]}
done
# Git Config
git config --global user.name Gutem
git config --global user.email gutemhc@gmail.com
# Homebrew's Casks Apps
cask_apps=(
adium
dropbox
dockertoolbox
iterm2
sublime-text3
heroku-toolbelt
google-chrome
firefox
opera
virtualbox
virtualbox-extension-pack
vagrant
flux
vlc
ubersicht
limechat
tunnelblick
balsamiq-mockups
keka
skype
basictex
kicad
arduino
fritzing
)
for (( i = 0 ; i < ${#cask_apps[@]} ; i++ )) do
echo -e "${green}[+] Installing ${cask_apps[$i]} ${NC}"
brew cask install ${cask_apps[$i]}
done
################################################################################
# ZSH
################################################################################
# Changes the default Shell to ZSH
echo "${green}[+] Changing to ZSH${NC}"
sudo echo "/usr/local/bin/zsh" >> /etc/shells
chsh -s "$(which zsh)"
# Install Oh-my-zsh
echo -e "${green}[+] Installing oh-my-zsh${NC}"
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
# zsh-syntax-highlighting
cd ~/.oh-my-zsh/custom/plugins || exit
git clone git://github.com/zsh-users/zsh-syntax-highlighting.git
echo "plugins=(zsh-syntax-highlighting)" >> ~/.zshrc
# HTTP2 enabled cURL
echo "alias curl='/usr/local/bin/curl'" >> ~/.dotfiles/zsh/aliases.zsh
reload!
# Install dotfiles
git clone https://github.com/Gutem/dotfiles.git ~/.dotfiles
cd ~/.dotfiles
# script/bootstrap
# Source Autoenv
echo -e "${green}[+] Sourcing Autoenv into .zshrc${NC}"
echo "source /usr/local/opt/autoenv/activate.sh" >> ~/.zshrc
################################################################################
# Install BKPG
################################################################################
echo -e "${green}[+] Installing BPKG${NC}"
curl -Lo- http://get.bpkg.io | bash
echo -e "${green}[+] Updating BPKG${NC}"
bpkg update
# BPKG Installs
echo -e "${green}[+] Installing rauchg/wifi-password${NC}"
bpkg install rauchg/wifi-password
################################################################################
# RBEnv, Rubies and Gems
################################################################################
# RBEnv Gem Rehash Plugin
git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
echo -e "${green}[+] Installing Ruby 2.2.3 ${NC}"
rbenv install 2.2.3
rbenv global 2.2.3
# Ruby Gems
gems=(
haml
sass
rails
friction
)
echo -e "${green}[+] Updating RubyGems${NC}"
gem update --system
for (( i = 0 ; i < ${#gems[@]} ; i++ )) do
echo -e "${green}[+] Installing ${gems[$i]} gem${NC}"
gem install ${gems[$i]}
done
################################################################################
# Python
################################################################################
# Update Python's pip
echo -e "${green}[+] Updating pip${NC}"
pip install --upgrade pip setuptools
################################################################################
# NVM (Node Version Manager), Node and NPM Apps
################################################################################
# Add NVM's working directory to your $HOME path (if it doesn't exist):
mkdir ~/.nvm
# Add the following to $HOME/.bashrc, $HOME/.zshrc, or your shell's equivalent configuration file:
echo "export NVM_DIR=~/.nvm" >> ~/.zshrc
echo "source $(brew --prefix nvm)/nvm.sh" >> ~/.zshrc
# NVM Installs
echo -e "${green}[+] Installing lastest Node using NVM${NC}"
nvm install node
nvm alias default node
# Nodejs tools
npm_apps=(
npm-dview
gulp
bower
nodemon
cordova
titanium
alloy
ios-sim
plato
# ti-inspector
)
echo -e "${green}[+] Updating NPM${NC}"
npm install -g npm
for (( i = 0 ; i < ${#npm_apps[@]} ; i++ )) do
echo -e "${green}[+] Installing ${npm_apps[$i]}${NC}"
npm install -g ${npm_apps[$i]}
done
################################################################################
# Sublime Text
################################################################################
# Install Sublime's Package Control
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/ || exit
git clone git://github.com/wbond/sublime_package_control.git Package\ Control
cd Package\ Control || exit
git checkout python3
# Haskell's Pandoc
cabal update
cabal install pandoc
# Pandoc dependencie to output PDFs
tlmgr install collection-fontsrecommended
# Android SDK API install
echo "export ANDROID_HOME=/usr/local/opt/android-sdk" >> ~/.zshrc
android
# Go get command
echo "export PATH=$PATH:/usr/local/opt/go/libexec/bin" >> ~/.zshrc
# Titanium SDK Install
titanium sdk install --default
titanium setup
################################################################################
# Docker
# https://docs.docker.com/installation/mac/#from-your-shell
################################################################################
brew install docker-machine
docker-machine create --driver virtualbox default
eval "$(docker-machine env default)"
docker run hello-world
################################################################################
# Gqrx - SDR
# https://github.com/chleggett/homebrew-gqrx
################################################################################
# Homebrew's Taps
gqrx_taps=(
# Gqrx dependencies
metacollin/gnuradio
chleggett/gqrx
chleggett/gr-osmosdr
)
for (( i = 0 ; i < ${#gqrx_taps[@]} ; i++ )) do
echo -e "${green}[+] Tapping ${gqrx_taps[$i]} repository${NC}"
brew tap ${gqrx_taps[$i]}
done
# Python dependencies
pip_apps=(
Cheetah
lxml
matplotlib
numpy
scipy
docutils
sphinx
)
for (( i = 0 ; i < ${#pip_apps[@]} ; i++ )) do
echo -e "${green}[+] Installing ${pip_apps[$i]} ${NC}"
pip install ${pip_apps[$i]}
done
echo -e "${green}[+] Installing GNURadio${NC}"
brew install gnuradio
# librtlsdr dependencie
echo -e "${green}[+] Installing librtlsdr${NC}"
brew install librtlsdr --HEAD
# Install the app
echo -e "${green}[+] Installing Gqrx${NC}"
brew install gqrx
brew linkapps gqrx
################################################################################
# Lazarus & Free Pascal
# http://lazarus.freepascal.org/ http://freepascal.org/
################################################################################
# Homebrew's Casks Apps
lazarus=(
fpc
fpcsrc
lazarus
)
echo -e "${green}[+] Installing GNU Debugger${NC}"
brew install gdb
for (( i = 0 ; i < ${#lazarus[@]} ; i++ )) do
echo -e "${green}[+] Installing ${lazarus[$i]} ${NC}"
brew cask install ${lazarus[$i]}
done
################################################################################
# Clean up all the mess
################################################################################
echo -e "${green}[+] Cleaning up Homebrew Packages${NC}"
brew cleanup
cask cleanup
echo -e "${green}[+] Cleaning up RubyGems Packages${NC}"
gem cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment