Skip to content

Instantly share code, notes, and snippets.

@pal
Last active November 27, 2022 00:32
Show Gist options
  • Save pal/5f31ea7912f1077c1bcf to your computer and use it in GitHub Desktop.
Save pal/5f31ea7912f1077c1bcf to your computer and use it in GitHub Desktop.
sh <(curl -sL https://goo.gl/2FSNYE)
tap "caskroom/cask"
tap "caskroom/fonts"
tap "caskroom/versions"
tap "homebrew/bundle"
tap "homebrew/core"
tap "homebrew/dupes"
tap 'caskroom/cask'
tap 'caskroom/fonts'
tap 'caskroom/versions'
tap 'homebrew/bundle'
tap 'homebrew/core'
tap 'homebrew/dupes'
cask "alfred"
cask "atom"
cask "dropbox"
cask "firefox"
cask "font-asap"
cask "font-eb-garamond"
cask "font-input"
cask "font-open-sans"
cask "font-open-sans-condensed"
cask "font-sanfrancisco"
cask "font-source-code-pro"
cask "font-trebuchet-ms"
cask "google-chrome"
cask "google-drive"
cask "java"
cask "lastpass"
cask "microsoft-office"
cask "paparazzi"
cask "postman"
cask "sketch"
cask "skitch"
cask "skype"
cask "slack"
cask "spotify"
cask "steam"
cask "transmission"
cask "transmit"
cask "tripmode"
cask "tunnelblick"
cask "visual-studio-code"
cask "vlc"
brew "ant"
brew "bash"
brew "cabextract"
brew "casperjs"
brew "certbot"
brew "docker"
brew "git"
brew "gnu-sed"
brew "jq"
brew "mackup"
brew "mas"
brew "maven"
brew "node"
brew "openssl"
brew "phantomjs"
brew "python"
brew "slimerjs"
brew "sqlite"
brew "wget"
brew "yarn"
mas "Evernote", id: 406056744
mas "Keynote", id: 409183694
mas "LastPass", id: 926036361
mas "Microsoft Remote Desktop", id: 715768417
mas "Numbers", id: 409203825
mas "OmniGraffle", id: 1142578753
mas "Pages", id: 409201541
mas "Pixelmator", id: 407963104
mas "StuffIt Expander", id: 405580712
mas "Telegram", id: 747648890
mas "TextWrangler", id: 404010395
mas "Wallcat", id: 1000397973
mas "Xcode", id: 497799835
# Disabled apps
#brew 'autoconf'
#brew 'automake'
#brew 'clib'
#brew 'cmake'
#brew 'elasticsearch'
#brew 'findutils'
#brew 'gcc'
#brew 'gdbm'
#brew 'gettext'
#brew 'glib'
#brew 'gmp'
#brew 'gnupg'
#brew 'gnupg2'
#brew 'gpg-agent'
#brew 'heroku'
#brew 'homebrew/php/php70'
#brew 'homebrew/php/phpunit'
#brew 'homebrew/science/r'
#brew 'jansson'
#brew 'jenv'
#brew 'mongodb'
#brew 'ncdu'
#brew 'nvm'
#brew 'oniguruma'
#brew 'otto'
#brew 'pcre'
#brew 'pkg-config'
#brew 'postgresql'
#brew 'r'
#brew 'rbenv'
#brew 'readline'
#brew 'ruby-build'
#brew 'sbt'
#brew 'scala'
#brew 'tesseract', args: ['with-all-languages']
#brew 'unixodbc'
#brew 'xz'
#cask "5kplayer"
#cask "chrome-devtools"
#cask "rescuetime"
#cask 'datagrip'
#cask 'google-hangouts'
#cask 'hipchat'
#cask 'mamp'
#cask 'noun-project'
#cask 'postico'
#cask 'pritunl'
#cask 'virtualbox'
#mas 'Bear', id: 1091189122
#mas 'Civilization Beyond Earth', id: 926919592
#mas 'GIF Keyboard', id: 1043270657
#mas 'GarageBand', id: 682658836
#mas 'OmniGraffle', id: 1142578753
#mas 'iMovie', id: 408981434
#mas 'iPhoto', id: 408981381
#!/usr/bin/env bash
#
# TODO
#
# Keep raw output log as well as short output (ok/not ok per application)
# UI with memory (use GH profiles)
# Output needed post-installation work for each supported cask/gem/setting (including reboot)
# optional: register install run an output to central location with machine info to improve service
# optional: suggest extras based on your recipe
# keep tabs on prereqs to run things in the right order
# support resume and running on existing system
# optional: support uninstall?
# make it possible to record current system as a recipe (at least a best guess)
# put only my selected apps as persistent in the dock
#
# partial credits (lemme know who I forgot!)
# https://gist.github.com/brandonb927/3195465/
#
#
# Missing recipies
# Sophos Home
# Ecamm Skype Callrecorder
# GlobalProtect VPN-client
echo "--------------------------------------------------"
echo " This script will restart and will likely require "
echo " you to give it some love. Manual love that is."
echo "--------------------------------------------------"
# First get xcode Command Line Developer Tools
if xcode-select --install 2>&1 | grep installed; then
echo "xcode command line dev tools installed";
else
echo "Installing xcode command line dev tools";
# https://gist.github.com/brysgo/9007731
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"
end tell
end tell
EOD
read "Press any key to continue (when installation is complete)"
sudo xcodebuild -license accept
fi
# Now install homebrew
if test ! $(which brew); then
echo "Installing Homebrew ..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "Updating Homebrew ..."
brew update
brew upgrade
fi
# Install all brews from the Brewfile,start with mas
curl -sL https://gist.githubusercontent.com/pal/5f31ea7912f1077c1bcf/raw/Brewfile > Brewfile
brew tap homebrew/bundle
brew bundle
sudo gem install bundler
git config --global branch.autoSetupRebase always
git config --global color.ui auto
git config --global core.autocrlf input
git config --global credential.helper osxkeychain
git config --global merge.ff false
git config --global pull.rebase true
git config --global push.default simple
git config --global rebase.autostash true
git config --global rerere.autoUpdate true
git config --global rerere.enabled true
git config --global user.name "Pål Brattberg"
git config --global user.email [email protected]
mkdir $HOME/source
apm install jsonlint
pip install --upgrade pip
# pip install csvkit
# csvkit edge from github
#pip install -e git+git://github.com/onyxfish/csvkit.git@master#egg=csvkit
pip install awscli
mkdir -p "$HOME/.aws"
cat << EOF > "$HOME/.aws/credentials"
[default]
aws_access_key_id=ACCESS_KEY_HERE
aws_secret_access_key=SECRET_ACCESS_KEY_HERE
EOF
cat << EOF > "$HOME/.aws/config"
[default]
region=eu-west-1
output=json
EOF
echo "Be sure to insert real values in $HOME/.aws/credentials when done"
echo "Adding homeshick ..."
git clone git://github.com/andsens/homeshick.git $HOME/.homesick/repos/homeshick
source "$HOME/.homesick/repos/homeshick/homeshick.sh"
homeshick -f clone pal/profile
ln -s $HOME/.profile.d/init $HOME/.profile
# this could seriously screw you up if I didn't keep a backup
mv ~/.bash_profile ~/.bash_profile.bak
echo 'source "${HOME}/.profile"' > ~/.bash_profile
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
#echo "Upgrading bash ..."
#sudo bash -c "echo $(brew --prefix)/bin/bash >> /private/etc/shells"
homeshick link
brew doctor
sudo gem update --system
# Fix defaults etc
echo ""
echo "Automatically quit printer app once the print jobs complete"
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
export COMPUTER_NAME="pal-macbook-pro"
echo ""
echo "Setting computer name to: '${COMPUTER_NAME}' (as done via System Preferences >> Sharing)"
sudo scutil --set ComputerName $COMPUTER_NAME
sudo scutil --set HostName $COMPUTER_NAME
sudo scutil --set LocalHostName $COMPUTER_NAME
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $COMPUTER_NAME
echo ""
echo "Reveal IP address, hostname, OS version, etc. when clicking the clock in the login window"
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
echo ""
echo "Check for software updates daily, not just once per week"
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
echo ""
echo "Disable Photos.app from starting everytime a device is plugged in"
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
echo ""
echo "Disable the sudden motion sensor (it's not useful for SSDs/current MacBooks)"
sudo pmset -a sms 0
echo ""
echo "Speeding up wake from sleep to 24 hours from an hour"
# http://www.cultofmac.com/221392/quick-hack-speeds-up-retina-macbooks-wake-from-sleep-os-x-tips/
sudo pmset -a standbydelay 86400
echo ""
echo "Increasing sound quality for Bluetooth headphones/headsets"
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
echo ""
echo "Enabling full keyboard access for all controls (enable Tab in modal dialogs, menu windows, etc.)"
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
echo ""
echo "Setting a blazingly fast keyboard repeat rate"
defaults write NSGlobalDomain KeyRepeat -int 0
echo ""
echo "Setting trackpad & mouse speed to a reasonable number"
defaults write -g com.apple.trackpad.scaling 2
defaults write -g com.apple.mouse.scaling 2.5
echo ""
echo "Requiring password immediately after sleep or screen saver begins"
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
echo ""
echo "Show icons for hard drives, servers, and removable media on the desktop"
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
echo ""
echo "Automatically open a new Finder window when a volume is mounted"
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
echo ""
echo "Show status bar in Finder by default"
defaults write com.apple.finder ShowStatusBar -bool true
echo ""
echo "Display full POSIX path as Finder window title"
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
echo ""
echo "Avoid creation of .DS_Store files on network volumes"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
echo ""
echo "Allowing text selection in Quick Look/Preview in Finder by default"
defaults write com.apple.finder QLEnableTextSelection -bool true
echo "Wipe all (default) app icons from the Dock"
echo "(This is only really useful when setting up a new Mac, or if you don't use the Dock to launch apps.)"
defaults write com.apple.dock persistent-apps -array
echo ""
echo "Privacy: Don't send search queries to Apple"
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
echo ""
echo "Enabling Safari's debug menu"
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
echo ""
echo "Enabling the Develop menu and the Web Inspector in Safari"
defaults write com.apple.Safari IncludeDevelopMenu -bool true
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
defaults write com.apple.Safari "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" -bool true
echo ""
echo "Adding a context menu item for showing the Web Inspector in web views"
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
echo ""
echo "Disabling the annoying backswipe in Chrome"
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false
echo ""
echo "Using the system-native print preview dialog in Chrome"
defaults write com.google.Chrome DisablePrintPreview -bool true
defaults write com.google.Chrome.canary DisablePrintPreview -bool true
echo ""
echo "Enabling UTF-8 ONLY in Terminal.app and setting the Pro theme by default"
defaults write com.apple.terminal StringEncodings -array 4
defaults write com.apple.Terminal "Default Window Settings" -string "Pro"
defaults write com.apple.Terminal "Startup Window Settings" -string "Pro"
# Hot corners
# Possible values:
# 0: no-op
# 2: Mission Control
# 3: Show application windows
# 4: Desktop
# 5: Start screen saver
# 6: Disable screen saver
# 7: Dashboard
# 10: Put display to sleep
# 11: Launchpad
# 12: Notification Center
# Top left screen corner → Mission Control
#defaults write com.apple.dock wvous-tl-corner -int 2
#defaults write com.apple.dock wvous-tl-modifier -int 0
# Top right screen corner → Desktop
#defaults write com.apple.dock wvous-tr-corner -int 4
#defaults write com.apple.dock wvous-tr-modifier -int 0
# Bottom left screen corner → Start screen saver
#defaults write com.apple.dock wvous-bl-corner -int 5
#defaults write com.apple.dock wvous-bl-modifier -int 0
echo ""
echo "Hot corners: Bottom right screen corner → Start screen saver"
defaults write com.apple.dock wvous-br-corner -int 5
defaults write com.apple.dock wvous-br-modifier -int 0
echo ""
echo "Restart dock"
killall Dock
echo "Cleaning up ..."
brew cleanup
brew cask cleanup
brew linkapps
echo "Run 'mackup restore' after DropBox has done syncing"
@christopheranderton
Copy link

christopheranderton commented Feb 3, 2017

For AppStore installs, there is always mas (https://github.com/argon/mas)
Cheers!

@pal
Copy link
Author

pal commented Mar 3, 2017

Awesome! Thanks for that tip @christopheranderton!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment