Last active
January 14, 2020 21:04
-
-
Save joelvh/a58680a788331f0952adf2a8d3fb54bd to your computer and use it in GitHub Desktop.
Install Mac software updates, apps and Homebrew dependencies via command line script
This file contains hidden or 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
### iTerm ### | |
# See https://www.iterm2.com/3.3/documentation-scripting-fundamentals.html | |
function iterm2_print_user_vars() { | |
iterm2_set_user_var phpVersion $(php -v | awk '/^PHP/ { print $2 }') | |
iterm2_set_user_var rubyVersion $(ruby -v | awk '{ print $2 }') | |
iterm2_set_user_var nodeVersion $(node -v) | |
} | |
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" | |
### Environment ### | |
export HOMEBREW_CASK_OPTS="--appdir=/Applications" | |
export PATH="~/.composer/vendor/bin:$PATH" | |
export PATH="/Applications/Araxis\ Merge.app/Contents/Utilities:$PATH" | |
export PATH="/usr/local/bin:$PATH" | |
export PATH="/usr/local/sbin:$PATH" | |
export XML_CATALOG_FILES="/usr/local/etc/xml/catalog" | |
#export CURL_CA_BUNDLE=/usr/share/curl/curl-ca-bundle.crt | |
export SSL_CERT_FILE=/usr/local/opt/curl-ca-bundle/share/ca-bundle.crt | |
export JRUBY_OPTS=--1.9 | |
export NVM_DIR="$HOME/.nvm" | |
### Shortcuts ### | |
alias ll='ls -la' | |
### Shell Setup ### | |
[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh | |
[ -f `brew --prefix`/etc/bash_completion ] && . `brew --prefix`/etc/bash_completion | |
if type brew 2&>/dev/null; then | |
source "$(brew --prefix)/etc/bash_completion" | |
else | |
echo "run: brew install git bash-completion" | |
fi | |
eval "$(rbenv init -)" | |
. "/usr/local/opt/nvm/nvm.sh" | |
# twilio autocomplete setup | |
TWILIO_AC_BASH_SETUP_PATH=$HOME/.twilio-cli/autocomplete/bash_setup && test -f $TWILIO_AC_BASH_SETUP_PATH && source $TWILIO_AC_BASH_SETUP_PATH; |
This file contains hidden or 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
# TODO: use Mac `defaults` command to setup Mac and app preferences | |
# SEE: https://pawelgrzybek.com/change-macos-user-preferences-via-command-line/ | |
# SEE: https://github.com/mathiasbynens/dotfiles/blob/master/.macos |
This file contains hidden or 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
# Ask for the administrator password upfront | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished | |
while true; do sudo -n true; sleep 20; kill -0 "$$" || exit; done 2>/dev/null & | |
update_mac () { | |
printf "\n\n### UPDATE MAC SOFTWARE ###\n\n" | |
# Install Mac software updates | |
softwareupdate -i -a | |
# Install Xcode command line tools | |
xcode-select --install | |
} | |
install_tools () { | |
printf "\n\n### INSTALL TOOLS ###\n\n" | |
# Install Homebrew | |
echo "\n" | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
# Add to bash profile | |
export HOMEBREW_CASK_OPTS="--appdir=/Applications" | |
# Update Homebrew | |
brew update | |
# Install Homebrew basics | |
brew install ack automake bash bash-completion cmake curl curl-openssl emacs erlang gcc gettext git lua openssl php python pkg-config qt rbenv readline rename rsync ruby-build watch wget | |
# Switch to use bash instead of zsh for current user | |
chsh -s /bin/bash | |
# Install Homebrew tools | |
brew install dnsmasq docker-compose-completion docker imageoptim-cli awscli awslogs brotli composer ec2-ami-tools elasticsearch ffmpeg gifsicle graphicsmagick graphite2 graphviz imagemagick jpeg jpegoptim kibana lame logstash mcrypt media-info memcached mysql nginx opencv optipng p7zip pack pngcrush pngquant postgresql rds-command-line-tools redis s3cmd sqlite webp wp-cli | |
# Install Heroku CLI | |
brew tap heroku/brew && brew install heroku | |
# Install NVM | |
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash | |
# Start services | |
brew services start --all | |
echo "Done installing" | |
} | |
setup_env () { | |
printf "\n### SETUP ENVIRONMENT ###\n\n" | |
export HOMEBREW_CASK_OPTS="--appdir=/Applications" | |
export PATH="~/.composer/vendor/bin:$PATH" | |
export PATH="/Applications/Araxis\ Merge.app/Contents/Utilities:$PATH" | |
export PATH="/usr/local/bin:$PATH" | |
export PATH="/usr/local/sbin:$PATH" | |
export XML_CATALOG_FILES="/usr/local/etc/xml/catalog" | |
#export CURL_CA_BUNDLE=/usr/share/curl/curl-ca-bundle.crt | |
export SSL_CERT_FILE=/usr/local/opt/curl-ca-bundle/share/ca-bundle.crt | |
export JRUBY_OPTS=--1.9 | |
### NVM ### | |
export NVM_DIR="$HOME/.nvm" | |
. "$NVM_DIR/nvm.sh" | |
. "$NVM_DIR/bash_completion" | |
} | |
install_packages () { | |
printf "\n\n### INSTALL PACKAGES ###\n\n" | |
# Install Node | |
nvm install node --lts --latest-npm | |
# Install NPM packages | |
npm install -g yarn serverless | |
# Install Laravel things | |
composer global require laravel/valet laravel/vapor-cli | |
valet install | |
} | |
install_apps () { | |
printf "\n\n### INSTALL APPS ###\n\n" | |
# Install Cask apps | |
brew cask install chromedriver docker ngrok google-chrome firefox iterm2 visual-studio-code 1password alfred appcleaner araxis-merge code42-crashplan evernote gas-mask dropbox macupdate github gitter slack imageoptim discord intel-power-gadget loom zoomus mediainfo metabase microsoft-office notion onyx purevpn rescuetime skype sketch homebrew/cask-versions/sequel-pro-nightly spotify the-unarchiver tripmode virtualbox | |
} | |
update_mac | |
install_tools | |
setup_env | |
install_packages | |
install_apps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment