Skip to content

Instantly share code, notes, and snippets.

@emilhorlyck
Last active January 31, 2023 12:48
Show Gist options
  • Save emilhorlyck/4c5a40fbf6b169788ab5b9e50ba329ea to your computer and use it in GitHub Desktop.
Save emilhorlyck/4c5a40fbf6b169788ab5b9e50ba329ea to your computer and use it in GitHub Desktop.
Script to clean install all relevant software on a new mac.
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# These will be specified en the last echo
#
# Notes:
#
# - If installing full Xcode, it's better to install that first from the app
# store before running the bootstrap script. Otherwise, Homebrew can't access
# the Xcode libraries as the agreement hasn't been accepted yet.
#
# run from gist $ bash <(curl -Ls https://gist.githubusercontent.com/eHorlyck/4c5a40fbf6b169788ab5b9e50ba329ea/raw/c4533a1689f94ad2a47ab74e115243b54ef8d260/clean_install.sh)
#
#
# Reading:
#
# - http://lapwinglabs.com/blog/hacker-guide-to-setting-up-your-mac
# - https://gist.github.com/MatthewMueller/e22d9840f9ea2fee4716
# - https://news.ycombinator.com/item?id=8402079
# - http://notes.jerzygangi.com/the-best-pgp-tutorial-for-mac-os-x-ever/
echo "Starting bootstrapping"
# 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)"
fi
# Update homebrew recipes
brew update
# # Install GNU core utilities (those that come with OS X are outdated)
# brew tap homebrew/dupes
# brew install coreutils
# brew install gnu-sed --with-default-names
# brew install gnu-tar --with-default-names
# brew install gnu-indent --with-default-names
# brew install gnu-which --with-default-names
# brew install gnu-grep --with-default-names
# # Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
# brew install findutils
# # Install Bash 4
# brew install bash
echo # (optional) move to a new line
echo # (optional) move to a new line
read -p "Press enter when Xcode is done installing and have been opened for the first time " -n 1 -r
echo # (optional) move to a new line
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
PACKAGES=(
# ack
# autoconf
# automake
# boot2docker
# dockutil
ffmpeg
# gettext
# gifsicle
git
# graphviz
# hub
# imagemagick
jq
# kite
# libjpeg
# libmemcached
# lynx
mas
markdown
# memcached
# mercurial
npm
# pkg-config
# postgresql
# python
python3
# pypy
# rabbitmq
# rename
# speedtest-cli
# ssh-copy-id
# terminal-notifier
# the_silver_searcher
# tmux
# transmission
tree
# vim
wget
)
echo "Installing packages..."
brew install ${PACKAGES[@]}
echo "Cleaning up..."
brew cleanup
echo "Installing cask..."
# brew install caskroom/cask/brew-cask
CASKS=(
android-studio
# appcleaner
balenaetcher
# bartender
# colluquy
# caffeine
dropbox
figma
# filezilla
# firefox
# flux
google-chrome
# google-drive-file-stream
# gramps
private-internet-access
# gpgtools
icons8
iterm2
# macvim
# mtmr
obsidian
# parallels-desktop
# plex-media-server
private-internet-access
# skype
slack
# spectacle
teamviewer
# ticktick
# vagrant
# virtualbox
visual-studio-code
# vlc
)
echo "Installing cask apps..."
brew install --cask ${CASKS[@]}
echo "Installing node modules..."
npm install live-server -g
npm install node-red -g
echo "Installing fonts..."
brew tap caskroom/fonts
FONTS=(
font-inconsolidata
font-roboto
font-clear-sans
)
brew cask install ${FONTS[@]}
echo "Installing Python packages..."
PYTHON_PACKAGES=(
# ipython
virtualenv
# virtualenvwrapper
)
sudo pip install ${PYTHON_PACKAGES[@]}
echo "Installing Ruby gems"
RUBY_GEMS=(
# bundler
# filewatcher
cocoapods
)
sudo gem install ${RUBY_GEMS[@]}
# echo "Installing global npm packages..."
# npm install marked -g
echo "Configuring OSX..."
# # Set fast key repeat rate
# defaults write NSGlobalDomain KeyRepeat -int 0
# Require password as soon as screensaver or sleep mode starts
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
# move Dock to the left
# defaults write com.apple.dock orientation left
# Show filename extensions by default
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# # Enable tap-to-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
# defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# # Disable "natural" scroll
# defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
echo "Creating folder structure..."
cd ~
# [[ ! -d Wiki ]] && mkdir Wiki
[[ ! -d Development ]] && mkdir Development
echo "cloning blog"
cd Development
git clone https://github.com/eHorlyck/eHorlyck.github.io.git
echo "Starting to download apps from Appstore"
APPS=(
#"Magnet"
441258766
#"Notability"
# 736189492
#Prepo
# 476533227
#"Sweet home 3d"
# 669289700
#"Toggl"
# 957734279
#"Amphetamine"
937984704
)
mas install ${APPS[@]}
# echo "Installing apps using wget"
open .
echo "Installing Flutter dependencies"
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
brew update
brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
brew install ios-deploy
brew install cocoapods
pod setup
open -a "Google Chrome" https://flutter.dev/docs/get-started/install/macos
echo "cloning Flutter to Projects"
cd Projects
git clone https://github.com/flutter/flutter.git
say "Setup complete! - Let's go!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment