Skip to content

Instantly share code, notes, and snippets.

@maxkorp
Last active September 25, 2018 18:56
Show Gist options
  • Save maxkorp/9805414db588dda1427a16f15963c42c to your computer and use it in GitHub Desktop.
Save maxkorp/9805414db588dda1427a16f15963c42c to your computer and use it in GitHub Desktop.
New mac install shell script
#!/bin/bash
# Ensure not root
{
if [ "$EUID" -e 0 ]
then echo "Please do not run this script as root"
exit
fi
}
# Read Password
{
echo This script requires admin priviledges, but cannot be run as root.
echo -n Password:
read -s PASSWORD
echo
echo $PASSWORD > ./askpass.sh
echo $PASSWORD | sudo -S chmod +x ./askpass.sh
export SUDO_ASKPASS=`pwd`/askpass.sh
function cleanup {
rm -f ./askpass.sh
}
trap cleanup EXIT
}
# install xcode cli tools
{
xcode-select --install
sleep 1
osascript <<EOD
tell application "System Events"
tell process "Install Command Line Developer Tools"
keystroke return
click button "Agree" of window "License Agreement"
delay 1
keystroke return
repeat
delay 5
if exists (button "Done" of window 1) then
click button "Done" of window 1
exit repeat
end if
end repeat
end tell
end tell
EOD
}
# install homebrew
{
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
declare -a brews=(
'chruby'
'cmake'
'elixir'
'git'
'mongo'
'ruby-install'
'zsh'
)
for i in "${brews[@]}"
do
brew install "$i"
done
}
# install brew-cask
{
brew tap caskroom/cask
declare -a casks=(
'atom'
'beyond-compare'
'firefox'
'gitkraken'
'google-chrome'
'iterm2'
'limechat'
'scroll-reverser'
'slack'
'steam'
'yakyak'
)
for i in "${casks[@]}"
do
brew cask install "$i"
done
}
# install oh-my-zsh
{
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
rm $HOME/.bash*
}
# install nvm
{
rm -rf $HOME/.nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.zshrc # since nvm doesnt auto load up
nvm install 4
nvm install 6
nvm install node
}
# install ruby
# ruby-install --latest ruby
# source /usr/local/opt/chruby/share/chruby/auto.sh
# chruby > $HOME/.ruby-version
# install rust
curl https://sh.rustup.rs -sSf | sh -s -- -y
sudo rm /private/etc/sudoers.d/infinite-cache-this-is-bad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment