Last active
June 12, 2020 07:45
-
-
Save psengh/64705b1ecf4185580e07eabceae8ac57 to your computer and use it in GitHub Desktop.
Script to setup new OSX Machine
This file contains 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
#!/usr/bin/env bash | |
echo "Enter you Name : (Optional, to configure Git)" | |
read NAME | |
echo "Enter your Email : (Optional, to configure Git)" | |
read EMAIL | |
echo "Give a name to your Computer : (Optional, to set Host Name)" | |
read HOSTNAME | |
echo "Give a Passphrase for SSH Key : (Optional, leave it for an empty Passphrase)" | |
read PASSPHRASE | |
echo "Starting sudo session, so that you can leave the setup un attended..." | |
echo "Enter your Password :" | |
sudo -v | |
echo "Starting setup..." | |
# Check if user has given HOSTNAME | |
if test "$HOSTNAME"; then | |
echo "Setting Computer Name..." | |
sudo scutil --set ComputerName $HOSTNAME | |
sudo scutil --set HostName $HOSTNAME | |
sudo scutil --set LocalHostName $HOSTNAME | |
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $HOSTNAME | |
fi | |
# Check for Homebrew, install if we don't have it | |
if test ! "$(which brew)"; then | |
echo "Installing homebrew..." | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null | |
fi | |
# Update homebrew recipes | |
brew update | |
PACKAGES=( | |
automake | |
autoconf | |
git | |
node | |
redis | |
ruby | |
cairo | |
wget | |
python | |
pypy | |
rabbitmq | |
postgresql | |
mysql | |
heroku | |
) | |
echo "Installing packages..." | |
brew install "${PACKAGES[@]}" | |
echo "Cleaning up..." | |
brew cleanup | |
echo "Configuring Git..." | |
# Check if user has given NAME | |
if test "$NAME"; then | |
echo "Setting global username..." | |
git config --global user.name $NAME | |
fi | |
# Check if user has given EMAIL | |
if test "$EMAIL"; then | |
echo "Setting global email..." | |
git config --global user.email $EMAIL | |
fi | |
git config --global color.ui auto | |
# Check if user has given PASSPHRASE | |
if test "$PASSPHRASE"; then | |
echo "Creating SSH key with given Passphrase..." | |
ssh-keygen -f id_rsa -t rsa -C $EMAIL -N $PASSPHRASE | |
else | |
echo "Creating SSH key without Passphrase..." | |
ssh-keygen -f id_rsa -t rsa -C $EMAIL -N "" | |
fi | |
echo "Installing Cask..." | |
brew tap caskroom/cask | |
CASKS=( | |
google-chrome | |
postman | |
visual-studio-code | |
firefox | |
webstorm | |
slack | |
ccleaner | |
vlc | |
discord | |
) | |
echo "Installing cask apps..." | |
brew cask install "${CASKS[@]}" | |
echo "Installing fonts..." | |
brew tap caskroom/fonts | |
FONTS=( | |
font-open-sans | |
font-josefin-slab | |
font-arvo | |
font-allerta | |
font-junction | |
font-lato | |
font-vollkorn | |
font-oxygen | |
font-montserrat | |
font-roboto | |
font-clear-sans | |
) | |
brew cask install "${FONTS[@]}" | |
echo "Installing NPM Global packages..." | |
NPM_PACKAGES=( | |
learnyounode | |
express | |
express-generator | |
server | |
localtunnel | |
eslint | |
webpack | |
forever | |
fast-cli | |
nodemon | |
) | |
npm -g install "${NPM_PACKAGES[@]}" | |
echo "Installing Ruby gems..." | |
RUBY_GEMS=( | |
compass | |
rails | |
) | |
gem install "${RUBY_GEMS[@]}" | |
echo "Upgrading Pip..." | |
pip install --upgrade pip | |
echo "Installing Python packages..." | |
PYTHON_PACKAGES=( | |
virtualenv | |
virtualenvwrapper | |
Flask | |
Django | |
) | |
pip install "${PYTHON_PACKAGES[@]}" | |
echo "Configuring OSX..." | |
# Show battery percentage | |
defaults write com.apple.menuextra.battery ShowPercent YES | |
echo "Creating folder Workspace..." | |
[[ ! -d Workspace ]] && mkdir Workspace | |
echo "Exiting sudo session..." | |
sudo -k | |
echo "Setup complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment