Skip to content

Instantly share code, notes, and snippets.

@alassiter
Forked from vraravam/fresh-install-of-osx.sh
Created August 8, 2018 17:20
Show Gist options
  • Save alassiter/5d6e9cf374d54ae04ca31ded51cc4f85 to your computer and use it in GitHub Desktop.
Save alassiter/5d6e9cf374d54ae04ca31ded51cc4f85 to your computer and use it in GitHub Desktop.
Steps to get "up and running" with new Mac OSX
#!/bin/bash
#install cl dev tools
xcode-select --install
chsh -s /bin/zsh
sudo chmod 755 ~
sudo chmod 700 ~/.ssh
sudo chmod 600 ~/.ssh/id*
sudo chmod 644 ~/.ssh/id*.pub
<RESTART TERMINAL APP>
Install oh-my-zsh from https://github.com/robbyrussell/oh-my-zsh
<RESTART TERMINAL APP>
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
<RESTART TERMINAL APP>
sudo mkdir -p /usr/local
sudo chown -fR `whoami`:admin /usr/local/
sudo rm -rf ~/.gnupg # to delete gpg keys that might have been generated from an older version of gpg
#install homebrew
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update
brew install direnv zsh coreutils gpg autoconf automake readline asdf git
<RESTART TERMINAL APP>
# ASDF package manager
rm -rf ~/.asdf && git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.5.1
# Note: immediately after you install asdf, you will also have to echo certain lines into bash_profile or zshrc - please see here: https://github.com/asdf-vm/asdf
# since i have that already done, i dont have it in this script
asdf plugin-add erlang #https://github.com/asdf-vm/asdf-erlang.git
asdf plugin-add elixir #https://github.com/asdf-vm/asdf-elixir.git
asdf plugin-add ruby #https://github.com/asdf-vm/asdf-ruby.git
asdf plugin-add java #https://github.com/skotchpine/asdf-java
asdf plugin-add rust #https://github.com/code-lever/asdf-rust.git
asdf plugin-add golang #https://github.com/kennyp/asdf-golang.git
# Imports Node.js release team's OpenPGP keys to main keyring
asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
bash /usr/local/opt/asdf/plugins/nodejs/bin/import-release-team-keyring
asdf plugin-list
asdf plugin-update --all
# Note: Since I have already configured the `.tool-versions` file, we don't need to install each language separately
asdf install
# To list all versions of a plugin
asdf list-all erlang
# To reshim the plugin
asdf reshim erlang
# To set the global version
asdf global erlang 20.3.8
# default gems
gem install bundler rake rubocop
<RESTART TERMINAL APP>
# <FOLLOW instructions on https://github.com/vic/asdf-link to install for jdk>
#
# For eg:
# ls /Library/Java/JavaVirtualMachines/
# asdf install jdk 1.8.0
# ls /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/bin/*
# ln -vs /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/bin/* /Users/vijay/.asdf/installs/jdk/1.8.0/bin
# asdf reshim jdk
# To verify which version of elixir, etc
elixir -v
erl -v
# Enabling history for iex shell (might need to be done for each erl that is installed via asdf)
mkdir -p tmp
cd tmp
git clone https://github.com/ferd/erlang-history.git
cd erlang-history
sudo make install
cd ../..
rm -rf tmp/erlang-history
# VS Code settings is in a separate git repository
# git submodule add git@gitlab.com:avijayr/vscode.git .vscode
# mkdir -p ~/.vscode
# cd ~/.vscode
# git init .
# rm .git/config && ln -sf ~/Personal/dev/vscode.git.config .git/config
# git pull --all
# Note: I have moved away from using rvm and am currently using asdf - but these commands are here in case I switch back
# RVM:
# curl -sSL https://get.rvm.io | bash -s stable --auto-dotfiles --autolibs=homebrew
# rvm install ruby-2.5.0
# rvm use --default ruby-2.5.0
# rvm @global do gem install bundler termrc rake mailcatcher rubocop rubocop-rspec pry-byebug
# <RESTART TERMINAL APP>
# rvm all do gem update --system
# rvm cleanup all
# This causes an issue with openssl
# rvm @global do gem install gitrob
declare -a caskRoomArray=(
"caskroom/cask"
#"caskroom/homebrew-versions"
#"caskroom/fonts"
#"homebrew/binary"
#"homebrew/boneyard"
#"homebrew/dupes"
"homebrew/versions"
)
for i in "${caskRoomArray[@]}"
do
brew tap "$i"
done
brew update
# TODO: Find recipes for: finderpath
declare -a brewArray=(
"adr-tools"
# "android-sdk"
"ansible"
# "bash"
# "boot2docker"
# "chromedriver"
# "cmake"
"dep" # for go-lang
"docker-diff"
# "elasticsearch"
"fzf"
"git"
"git-crypt"
"golangci/tap/golangci-lint"
# "gource"
# "gradle"
# "graphviz"
# "kubernetes-cli"
# "libiconv"
# "libyaml"
# "maven" # PAM
# "mercurial"
# "mongodb"
# "mysql"
# "ngrok"
"openssl"
# "packer"
# "parallel" # PAM
# "phantomjs192" # PAM
# "pkg-config"
# "spidermonkey"
# "sqlcipher"
"tldr"
# "valgrind"
# "vim"
"wget"
)
for i in "${brewArray[@]}"
do
brew install "$i"
done
brew link -f openssl
brew link -f phantomjs192
$(brew --prefix)/opt/fzf/install
# brew uninstall -f erlang
# brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/77f353913f1e0edd7ba592308da2aa70e26570e1/Formula/erlang.rb
# brew pin erlang
# brew uninstall -f elixir
# brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f47cde4e2b771b4a8d170038a20ca703d20bdf0d/Formula/elixir.rb
# brew pin elixir
#brew uninstall -f imagemagick
#brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/6f014f2b7f1f9e618fd5c0ae9c93befea671f8be/Formula/imagemagick.rb
#brew pin imagemagick
#install casks
brew cask doctor
# TODO: Need to find instruction for veracrypt
declare -a caskArray=(
# "adobe-reader"
# "apache-couchdb"
# "android-file-transfer"
"appcleaner"
# "audacity"
"caffeine"
"ccleaner"
"docker"
# "dropbox"
# "dupeguru-me"
# "earlybird"
# "eclipse-jee"
# "eclipse-ide"
"etcher"
# "evernote"
# "filedrop"
# "firefox"
# "firefox-beta"
"firefoxnightly"
"flycut"
"franz"
# "freemind"
# "google-chrome"
# "google-drive"
# "hipchat"
# "imageoptim"
# "intellij-idea-ce"
"iterm2-beta"
"kdiff3"
"keepassxc"
# "libreoffice"
# "mattermost"
"monolingual"
# "musicbrainz-picard"
"ngrok"
# "omnidisksweeper"
# "omnigraffle"
"onyx"
"postgres"
# "psequel"
# "prezi"
"protonvpn"
"rubymine"
"sequel-pro"
"signal-beta"
"spectacle"
# "skype"
# "teamviewer"
"the-unarchiver"
"thunderbird-beta"
"tunnelblick"
"vagrant"
"virtualbox"
"virtualbox-extension-pack"
# "visual-studio-code"
"visual-studio-code-insiders"
"vlc"
# "xmind"
# "xtrafinder"
)
for i in "${caskArray[@]}"
do
brew cask install "$i"
done
brew cask cleanup
brew cleanup
mkdir -p ~/.bin
if [[ "$OSTYPE" = darwin* ]] ; then
brew linkapps
find ~/Applications -type l | while read f; do osascript -e "tell app \"Finder\" to make new alias file at POSIX file \"/Applications\" to POSIX file \"$(stat -f%Y "$f")\""; rm "$f"; done
rm -rf ~/Library/Application\ Support/Skype && ln -sf ~/Dropbox/Skype ~/Library/Application\ Support/Skype
rm -rf ~/Library/Application\ Support/Mozilla
rm -rf ~/Library/Mozilla
mkdir -p ~/Library/Application\ Support/Google/Chrome
rm -rf ~/Library/Application\ Support/Google/Chrome && ln -sf ~/Personal/vijay/ChromeProfile ~/Library/Application\ Support/Google/Chrome
mkdir -p ~/Library/Application\ Support/Firefox
mkdir -p ~/Personal/vijay/FirefoxProfile
rm -rf ~/Library/Application\ Support/Firefox/Crash\ Reports
rm -rf ~/Library/Application\ Support/Firefox/Profiles
rm -rf ~/Library/Application\ Support/Firefox/profiles.ini && ln -sf ~/Personal/vijay/profiles.ini.ff ~/Library/Application\ Support/Firefox/profiles.ini
touch ~/Library/Application\ Support/Firefox/ignore-dev-edition-profile
mkdir -p ~/Library/Thunderbird
mkdir -p ~/Personal/vijay/ThunderbirdProfile
rm -rf ~/Library/Thunderbird/Crash\ Reports
rm -rf ~/Library/Thunderbird/Profiles
rm -rf ~/Library/Thunderbird/profiles.ini && ln -sf ~/Personal/vijay/profiles.ini.tb ~/Library/Thunderbird/profiles.ini
sudo chown vijay ~/Library/Preferences
mkdir -p ~/OSX/Preferences
mv ~/Library/Preferences/* ~/OSX/Preferences
sudo rm -rf ~/Library/Preferences && ln -sf ~/OSX/Preferences ~/Library/Preferences
sudo chown vijay ~/Library/Application\ Support
mkdir -p ~/OSX/Application\ Support
mv ~/Library/Application\ Support/* ~/OSX/Application\ Support
sudo rm -rf ~/Library/Application\ Support && ln -sf ~/OSX/Application\ Support ~/Library/Application\ Support
mkdir -p ~/OSX/Saved\ Application\ State
mv ~/Library/Saved\ Application\ State/* ~/OSX/Saved\ Application\ State
sudo rm -rf ~/Library/Saved\ Application\ State && ln -sf ~/OSX/Saved\ Application\ State ~/Library/Saved\ Application\ State
fi
ln -s /usr/local/include/ImageMagick/wand /usr/local/include/wand && ln -s /usr/local/include/ImageMagick/magick /usr/local/include/magick
npm install -g npm@latest eslint eslint-config-defaults eslint-config-google eslint-plugin-backbone eslint-plugin-html
vagrant plugin install vagrant-vbguest
# TO install the ansible-elixir-stack tools for releasing elixir apps
# ansible-galaxy install HashNuke.elixir-stack
# Note: I have moved away from using rbenv and am currently using asdf - but these commands are here in case I switch back
# brew install rbenv ruby-build rbenv-gem-rehash
# brew uninstall openssl && brew install openssl
# brew uninstall readline
# brew install https://raw.githubusercontent.com/Homebrew/homebrew/0181c8a1633353affefabe257c170edbd6d7c008/Library/Formula/readline.rb
# brew pin readline
# echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
# source ~/.bash_profile
# git clone -- git://github.com/carsomyr/rbenv-bundler.git \
# ~/.rbenv/plugins/bundler
# rbenv install 1.9.3-p484
# rbenv global 1.9.3-p484
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment