Skip to content

Instantly share code, notes, and snippets.

@MarcScott
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MarcScott/0f8428263470c99185b0 to your computer and use it in GitHub Desktop.
Save MarcScott/0f8428263470c99185b0 to your computer and use it in GitHub Desktop.
#!/bin/bash
# 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 install coreutils
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
brew install findutils
# Install Bash 4
brew install bash
# Install more recent versions of some OS X tools
brew tap homebrew/dupes
brew install homebrew/dupes/grep
# Use above tools over Mac defaults
$PATH=$(brew --prefix coreutils)/libexec/gnubin:$PATH
# Install some binaries
binaries=(
wget
ffmpeg
python
python3
node
tree
git
--cocoa --srgb emacs
sdl
sdl_image
sdl_mixer
sdl_ttf
portmidi
markdown
pandoc
imagemagick
aspell
)
echo "installing binaries..."
brew install ${binaries[@]}
#link in emacs
ln -s /usr/local/Cellar/emacs/24.4/Emacs.app /Applications
#clean it all up
brew cleanup
#Install cask
brew install caskroom/cask/brew-cask
#and grab some apps
apps=(
alfred
google-chrome
appcleaner
firefox
flash
iterm2
virtualbox
vlc
transmission
skitch
steam
xquartz
caffeine
basictex
spectacle
)
# Install apps to /Applications
# Default is: /Users/$user/Applications
echo "installing apps..."
brew cask install --appdir="/Applications" ${apps[@]}
# link apps in alfred
brew cask alfred link
# and grab some fonts
brew tap caskroom/fonts
# fonts
fonts=(
font-m-plus
font-clear-sans
font-roboto
)
# install fonts
echo "installing fonts..."
brew cask install ${fonts[@]}
# link apps
brew linkapps
# install less
npm install -g less
# Install stuff needed fo pygame
brew tap homebrew/headonly
brew install --HEAD smpeg
brew install mercurial
# Grab virtualenv for python development
pip3 install virtualenv
# Let's make a virtualenv for pygame
mkdir PyProjects
cd PyProjects
virtualenv -p /usr/local/bin/Python3 pygameProjects
cd pygameProjects
source bin/activate
# Grab pygame
pip3 install hg+http://bitbucket.org/pygame/pygame
# deactivate the vitualenv and go home.
deactivate
cd ~/
#grab my dotfiles
git clone https://github.com/MarcScott/dotfiles.git
cp -r dotfiles/.emacs.d .emacs.d
cp dotfiles/.emacs .emacs
cp dotfiles/.bash_profile .bash_profile
cp dotfiles/.gitconfig .gitconfig
sudo rm -r dotfiles
#Now let's sort some system settings
# Ask for the administrator password upfront
sudo -v
echo "This script will make your Mac awesome"
echo ""
echo "Disabling OS X Gate Keeper"
echo "(You'll be able to install any app you want from here on, not just Mac App Store apps)"
sudo spctl --master-disable
sudo defaults write /var/db/SystemPolicy-prefs.plist enabled -string no
defaults write com.apple.LaunchServices LSQuarantine -bool false
echo""
echo ""
echo "Expanding the save panel by default"
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
echo ""
echo "Automatically quit printer app once the print jobs complete"
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
echo ""
echo "Saving to disk (not to iCloud) by default"
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
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
##FINDER STUFF
echo ""
echo "Showing icons for hard drives, servers, and removable media on the desktop"
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
echo ""
echo "Showing all filename extensions in Finder by default"
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
echo ""
echo "Showing status bar in Finder by default"
defaults write com.apple.finder ShowStatusBar -bool true
echo ""
echo "Allowing text selection in Quick Look/Preview in Finder by default"
defaults write com.apple.finder QLEnableTextSelection -bool true
echo ""
echo "Displaying full POSIX path as Finder window title"
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
echo ""
echo "Disabling the warning when changing a file extension"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
echo ""
echo "Use column view in all Finder windows by default"
defaults write com.apple.finder FXPreferredViewStyle Clmv
echo ""
echo "Avoiding the creation of .DS_Store files on network volumes"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
echo ""
echo "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
# Let's sort out the doc
# Wipe all (default) app icons from the Dock
echo ""
echo "Destroying all dock icons"
defaults write com.apple.dock persistent-apps -array
echo ""
echo "Setting the icon size of Dock items to 36 pixels for optimal size/screen-realestate"
defaults write com.apple.dock tilesize -int 36
echo ""
echo "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
echo ""
echo "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
#Now it's Safari's turn
echo ""
echo "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
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
#And now the terminal
echo ""
echo "Enabling UTF-8 ONLY in Terminal.app and setting the Homebrew theme by default"
defaults write com.apple.terminal StringEncodings -array 4
defaults write com.apple.Terminal "Default Window Settings" -string "Homebrew"
defaults write com.apple.Terminal "Startup Window Settings" -string "Homebrew"
echo "DONE with System stuff"
#Get a better keyboard
wget https://raw.github.com/grasuth/britishlhash/master/BritishLHash.keylayout
sudo mv BritishLHash.keylayout /System/Library/Keyboard\ Layouts/.
echo "You'll need to change the keyboard from the GUI"
#Grab my desktop wall paper
sudo wget http://fc08.deviantart.net/fs70/i/2010/309/1/3/glider_by_byronc-d327gro.png -P /Library/Desktop\ Pictures/
# Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and
# all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`.
rm -rf ~/Library/Application Support/Dock/desktoppicture.db
sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg
sudo ln -s /Library/Desktop\ Pictures/glider_by_byronc-d327gro.png /System/Library/CoreServices/DefaultDesktop.jpg
#sym link iCloud to Home Folder
ln -s /Volumes/Home/Library/Mobile\ Documents/com~apple~CloudDocs ~/iCloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment