-
-
Save elijahmurray/a71aa84432649f377a3ee9716af56f4e to your computer and use it in GitHub Desktop.
New Mac Setup Script
This file contains hidden or 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
# New Mac Setup | |
read -p "Please enter your email address: " email | |
echo "Creating an SSH key for you..." | |
ssh-keygen -t ed25519 -C "$email" | |
# Start the ssh-agent in the background | |
eval "$(ssh-agent -s)" | |
# Automatically add the configuration to ~/.ssh/config | |
cat >> ~/.ssh/config <<EOL | |
Host * | |
AddKeysToAgent yes | |
UseKeychain yes | |
IdentityFile ~/.ssh/id_ed25519 | |
EOL | |
# Check if on macOS and add the SSH key to the keychain if so | |
if [[ "$OSTYPE" == "darwin"* ]]; then | |
ssh-add -K ~/.ssh/id_ed25519 | |
else | |
ssh-add ~/.ssh/id_ed25519 | |
fi | |
echo "Please add this public key to Github. It has been copied to your clipboard." | |
echo "https://github.com/account/ssh" | |
pbcopy < ~/.ssh/id_ed25519.pub | |
read -p "Press [Enter] key after this..." | |
echo "Installing xcode-stuff" | |
xcode-select --install | |
# Wait for user to install Xcode command-line tools | |
read -p "Press [Enter] key once you've installed Xcode command-line tools..." | |
# Agree To Xcode, if necessary | |
if ! xcrun clang 2>&1 | grep -q "license"; then | |
sudo xcrun cc | |
fi | |
# Install Rosetta for Apple Silicon Devices only | |
if [[ $(uname -m) == "arm64" ]]; then | |
echo "Type 'A' and press return when prompted to install Rosetta." | |
softwareupdate --install-rosetta | |
fi | |
# Check for Homebrew and install if it's not installed | |
if test ! $(which brew); then | |
echo "Installing homebrew..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
fi | |
# Make brew command accessible, if not already set up | |
if ! grep -q '/opt/homebrew/bin/brew shellenv' "$HOME/.zprofile"; then | |
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile" | |
eval "$(/opt/homebrew/bin/brew shellenv)" | |
fi | |
# Update homebrew recipes | |
echo "Updating homebrew..." | |
brew update | |
echo "Installing Git..." | |
brew install git | |
echo "Installing python..." | |
brew install python | |
echo "Setting up Git configuration..." | |
read -p "Enter your GitHub username: " github_username | |
git config --global user.email "${github_username}@users.noreply.github.com" | |
echo "Installing Git utilities via Homebrew..." | |
# Uncomment any utilities you wish to install | |
# brew install git-extras | |
# brew install legit | |
# brew install git-flow | |
echo "Installing other brew utilities..." | |
# brew install tree | |
# brew install wget | |
# brew install trash | |
# brew install svn | |
# brew install mackup | |
# brew install node | |
brew install postgresql | |
brew install tmux | |
echo "Cleaning up brew" | |
brew cleanup | |
echo "Copying dotfiles from Github" | |
cd ~ | |
git clone [email protected]:elijahmurray/dotfiles.git .dotfiles | |
cd .dotfiles | |
sh install | |
echo "Installing Grunt CLI" | |
npm install -g grunt-cli | |
echo "Installing Oh My ZSH..." | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
# Uncomment the following lines if you want to use the specific theme and plugin | |
# echo "Setting up Oh My Zsh theme..." | |
# cd /Users/bradparbs/.oh-my-zsh/themes | |
# curl https://gist.githubusercontent.com/bradp/a52fffd9cad1cd51edb7/raw/cb46de8e4c77beb7fad38c81dbddf531d9875c78/brad-muse.zsh-theme > brad-muse.zsh-theme | |
# echo "Setting up Zsh plugins..." | |
# cd ~/.oh-my-zsh/custom/plugins | |
# git clone git://github.com/zsh-users/zsh-syntax-highlighting.git | |
echo "Setting ZSH as shell..." | |
chsh -s /bin/zsh | |
# Install Brew if not already installed | |
if test ! $(which brew); then | |
echo "Installing homebrew..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
fi | |
# Update brew recipes | |
brew update | |
# Install MAS (Mac App Store) utility using brew | |
brew install mas | |
echo "Please manually sign in to the Mac App Store using 'mas signin'" | |
# Once you have manually signed in, you can uncomment and use the next line | |
# mas install 497799835 # Xcode | |
# Define apps to be installed via Brew Cask | |
apps_cask=( | |
"spectacle" | |
"visual-studio-code" | |
"lastpass" | |
"brave-browser" | |
"iterm2" | |
"discord" | |
"slack" | |
"steam" | |
"raycast" | |
"krisp" | |
"superhuman" # Might need manual download if not on brew. | |
"notion" | |
"zoom" | |
"microsoft-teams" | |
"vimcal" | |
"spotify" | |
"figma" | |
"kindle" | |
"google-backup-and-sync" # Google Drive | |
"microsoft-word" | |
"microsoft-excel" | |
"telegram" | |
"signal" | |
"whatsapp" | |
"flux" | |
"rescuetime" | |
"descript" | |
) | |
# Install apps via Brew Cask to /Applications | |
echo "Installing apps with Brew..." | |
brew install --cask --appdir="/Applications" ${apps_cask[@]} | |
# If you have mackup backup and wish to restore settings, uncomment the next line. | |
# echo "Restoring setup from Mackup..." | |
# mackup restore | |
# Clean up after brew installations | |
brew cleanup | |
echo "Configuring macOS settings..." | |
# Allow text selection in Quick Look | |
defaults write com.apple.finder QLEnableTextSelection -bool TRUE | |
# Disabling macOS's GateKeeper (Caution: Be sure about the security implications) | |
sudo spctl --master-disable | |
sudo defaults write /var/db/SystemPolicy-prefs.plist enabled -string no | |
defaults write com.apple.LaunchServices LSQuarantine -bool false | |
# Miscellaneous Preferences | |
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true | |
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true | |
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true | |
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true | |
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false | |
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 | |
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false | |
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false | |
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 | |
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false | |
# Trackpad & Mouse Speed | |
defaults write -g com.apple.trackpad.scaling 4 | |
defaults write -g com.apple.mouse.scaling 2.5 | |
# Font & Display | |
defaults write NSGlobalDomain AppleFontSmoothing -int 2 | |
# Finder Preferences | |
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true | |
defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false | |
defaults write com.apple.finder FXPreferredViewStyle Clmv | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
# To apply some of the changes | |
killall Finder | |
#"Enabling snap-to-grid for icons on the desktop and in other icon views" | |
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist | |
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist | |
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist | |
#"Setting the icon size of Dock items to 36 pixels for optimal size/screen-realestate" | |
defaults write com.apple.dock tilesize -int 36 | |
#"Speeding up Mission Control animations and grouping windows by application" | |
defaults write com.apple.dock expose-animation-duration -float 0.1 | |
defaults write com.apple.dock "expose-group-by-app" -bool true | |
#"Setting Dock to auto-hide and removing the auto-hiding delay" | |
defaults write com.apple.dock autohide -bool true | |
defaults write com.apple.dock autohide-delay -float 0 | |
defaults write com.apple.dock autohide-time-modifier -float 0 | |
#"Setting email addresses to copy as '[email protected]' instead of 'Foo Bar <[email protected]>' in Mail.app" | |
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false | |
#"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" | |
#"Preventing Time Machine from prompting to use new hard drives as backup volume" | |
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true | |
#"Disable the sudden motion sensor as its not useful for SSDs" | |
sudo pmset -a sms 0 | |
#"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 | |
#"Disable annoying backswipe in Chrome" | |
# defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false | |
#"Setting screenshots location to ~/Desktop" | |
defaults write com.apple.screencapture location -string "$HOME/Desktop" | |
#"Setting screenshot format to PNG" | |
defaults write com.apple.screencapture type -string "png" | |
#"Hiding Safari's bookmarks bar by default" | |
defaults write com.apple.Safari ShowFavoritesBar -bool false | |
#"Hiding Safari's sidebar in Top Sites" | |
defaults write com.apple.Safari ShowSidebarInTopSites -bool false | |
#"Disabling Safari's thumbnail cache for History and Top Sites" | |
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 | |
#"Enabling Safari's debug menu" | |
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true | |
#"Making Safari's search banners default to Contains instead of Starts With" | |
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false | |
#"Removing useless icons from Safari's bookmarks bar" | |
defaults write com.apple.Safari ProxiesInBookmarksBar "()" | |
#"Allow hitting the Backspace key to go to the previous page in history" | |
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true | |
#"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 | |
#"Adding a context menu item for showing the Web Inspector in web views" | |
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true | |
#"Use `~/Downloads/Incomplete` to store incomplete downloads" | |
# defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true | |
# defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Downloads/Incomplete" | |
#"Don't prompt for confirmation before downloading" | |
# defaults write org.m0k.transmission DownloadAsk -bool false | |
#"Trash original torrent files" | |
# defaults write org.m0k.transmission DeleteOriginalTorrent -bool true | |
#"Hide the donate message" | |
# defaults write org.m0k.transmission WarningDonate -bool false | |
#"Hide the legal disclaimer" | |
# defaults write org.m0k.transmission WarningLegal -bool false | |
#"Disable 'natural' (Lion-style) scrolling" | |
# defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false | |
# Don’t automatically rearrange Spaces based on most recent use | |
# defaults write com.apple.dock mru-spaces -bool false | |
# Turn on tap to click | |
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true | |
# Use plain text mode for new TextEdit documents | |
defaults write com.apple.TextEdit RichText -int 0 | |
# Set default Finder location to home folder (~/) | |
defaults write com.apple.finder NewWindowTarget -string "PfLo" && \ | |
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}" | |
# Show Path bar in Finder | |
defaults write com.apple.finder ShowPathbar -bool true | |
# Setup RVM | |
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 | |
echo progress-bar > ~/.curlrc | |
curl -sSL https://get.rvm.io | bash | |
# Add RVM to PATH | |
export PATH="$PATH:$HOME/.rvm/bin" | |
# Install Ruby | |
rvm install ruby | |
# Install Ruby gem | |
gem install foreman | |
# Refresh Finder and Dock | |
killall Finder | |
killall Dock | |
echo "Installing Heroku..." | |
brew tap heroku/brew && brew install heroku | |
# Node, Yarn, Rails setup | |
brew install node | |
brew install yarn | |
gem install rails | |
# Optional: If you need node-sass globally | |
yarn global add node-sass | |
echo "Done!" | |
# TODOs | |
#@TODO install vagrant and sites folder |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment