Skip to content

Instantly share code, notes, and snippets.

@benjaminbasa
Forked from pongstr/DOTFILES-lite.md
Last active August 9, 2016 01:22
Show Gist options
  • Save benjaminbasa/bcdf738fbe9c41273861 to your computer and use it in GitHub Desktop.
Save benjaminbasa/bcdf738fbe9c41273861 to your computer and use it in GitHub Desktop.

Dotfiles Lite

Taken from mathiasbynens/dotfiles. Save time and pain from customising your clean-installed Mac, install web development tools and native applications. It's straight-forward and simple, here's how you run it:

Download osx.sh and tools.sh to your desktop, open osx.sh on your favorite text editor and change these lines:

# Set computer name (as done via System Preferences → Sharing)
sudo scutil --set ComputerName "benjaminbasa"
sudo scutil --set HostName "benjaminbasa"
sudo scutil --set LocalHostName "benjaminbasa"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "benjaminbasa"

so you don't end up with a computer named benjaminbasa, substitute that value with your name or your cat's name.

OSX Customisation


Open your finder and go to: Applications > Utilites > Terminal.app & run this command: $ sh ~/Desktop/osx.sh you might have to type in your password when necessary, you can scan through the script to see which OSX features will be changed.

Web Development Tools Installation


If you like to play with web development or have it as a job you can run tools.sh to install some of the awesome tools I use, just run it the way you did on the OSX customisation: $ sh ~/Desktop/tools.sh

Tools.sh will install the following:

Homebrew

Install/Update GEM

Native App Installation via Homebrew CASK

  • App Cleaner
  • Mozilla Firefox
  • Github for Mac
  • Google Chrome
  • Open Office
  • Skype
  • The Unarchiver
  • Utorrent
  • VLC Player
#!/usr/bin/env bash
# ~/.osx — http://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# General UI/UX
# ----------------------------------------------------------------------
# Set computer name (as done via System Preferences → Sharing)
sudo scutil --set ComputerName "benjaminbasa"
sudo scutil --set HostName "benjaminbasa"
sudo scutil --set LocalHostName "benjaminbasa"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "benjaminbasa"
# Menu bar: disable transparency
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool true
# Menu bar: show remaining battery time (on pre-10.8); hide percentage
defaults write com.apple.menuextra.battery ShowPercent -string "YES"
defaults write com.apple.menuextra.battery ShowTime -string "YES"
# Set sidebar icon size to medium
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1
# Scrollbars
# Possible values: `WhenScrolling`, `Automatic` and `Always`
defaults write NSGlobalDomain AppleShowScrollBars -string "WhenScrolling"
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Disable the crash reporter
defaults write com.apple.CrashReporter DialogType -string "none"
# Restart automatically if the computer freezes
systemsetup -setrestartfreeze on
# Check for software updates daily, not just once per week
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
# Trackpad, mouse, keyboard, Bluetooth accessories, and input
# ----------------------------------------------------------------------
# Trackpad: enable tap to click for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# Trackpad: map bottom right corner to right-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true
# Use scroll gesture with the Ctrl (^) modifier key to zoom
defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
# Follow the keyboard focus while zoomed in
defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
# Enable full keyboard access for all controls
# (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
# Automatically illuminate built-in MacBook keyboard in low light
defaults write com.apple.BezelServices kDim -bool true
# Turn off keyboard illumination when computer is not used for 5 minutes
defaults write com.apple.BezelServices kDimTime -int 300
# Set language and text formats
# Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with
# `Inches`, `en_GB` with `en_US`, and `true` with `false`.
defaults write NSGlobalDomain AppleLanguages -array "en"
defaults write NSGlobalDomain AppleLocale -string "en_US@currency=PHP"
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
defaults write NSGlobalDomain AppleMetricUnits -bool true
# Set the timezone; see `systemsetup -listtimezones` for other values
systemsetup -settimezone "Asia/Manila" > /dev/null
# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Screen
# ----------------------------------------------------------------------
# Require password immediately after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
# Save screenshots to the desktop
defaults write com.apple.screencapture location -string "$HOME/Desktop"
# Disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
# Enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2
# Enable HiDPI display modes (requires restart)
# sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
# I'll be getting a 15" Macbook Pro with Retina Display.. so excitedddd!
# Finder
# ----------------------------------------------------------------------
# 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 false
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
# Finder: allow text selection in Quick Look
defaults write com.apple.finder QLEnableTextSelection -bool true
# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Enable spring loading for directories
defaults write NSGlobalDomain com.apple.springing.enabled -bool true
# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# Disable disk image verification
defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
# 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
# Show item info near icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
# Show item info to the right of the icons on the desktop
/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist
# Enable 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
# Increase grid spacing for icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist
# Set the size of icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 32" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 48" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 48" ~/Library/Preferences/com.apple.finder.plist
# Use list view in all Finder windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# Disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false
# Empty Trash securely by default
defaults write com.apple.finder EmptyTrashSecurely -bool false
# Enable AirDrop over Ethernet and on unsupported Macs running Lion
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
# Enable the MacBook Air SuperDrive on any Mac
sudo nvram boot-args="mbasd=1"
# Show the ~/Library folder
chflags nohidden ~/Library
# Remove Dropbox’s green checkmark icons in Finder
file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns
[ -e "$file" ] && mv -f "$file" "$file.bak"
# Add iOS Simulator to Launchpad
ln -s /Applications/Xcode.app/Contents/Applications/iPhone\ Simulator.app /Applications/iOS\ Simulator.app
# Dock, Dashboard, and hot corners
# ----------------------------------------------------------------------
# Set the icon size of Dock items to 28 pixels
defaults write com.apple.dock tilesize -int 28
# Enable spring loading for all Dock items
defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true
# Show indicator lights for open applications in the Dock
defaults write com.apple.dock show-process-indicators -bool true
# Wipe all (default) app icons from the Dock
# 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
# Speed up Mission Control animations
defaults write com.apple.dock expose-animation-duration -float 0.1
# Make Dock icons of hidden applications translucent
defaults write com.apple.dock showhidden -bool true
# Reset Launchpad
find ~/Library/Application\ Support/Dock -name "*.db" -maxdepth 1 -delete
# Add a spacer to the left side of the Dock (where the applications are)
# defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
# Add a spacer to the right side of the Dock (where the Trash is)
# defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}'
# Safari & WebKit
# ----------------------------------------------------------------------
# Set Safari’s home page to `about:blank` for faster loading
defaults write com.apple.Safari HomePage -string "http://www.google.com/"
# Remove useless icons from Safari’s bookmarks bar
defaults write com.apple.Safari ProxiesInBookmarksBar '("Reading List")'
# Enable 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
# Add a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
# Time Machine
# ----------------------------------------------------------------------
# Prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# Disable local Time Machine backups
hash tmutil &> /dev/null && sudo tmutil disablelocal
# TextEdit, and Disk Utility
# ----------------------------------------------------------------------
# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0
# Open and save files as UTF-8 in TextEdit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
# Enable the debug menu in Disk Utility
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
defaults write com.apple.DiskUtility advanced-image-options -bool true
# Kill affected applications
# ----------------------------------------------------------------------
for app in "Dashboard" "Dock" "Finder" "Safari" "SystemUIServer" "Twitter" "iCal" "iTunes"; do
killall "$app" > /dev/null 2>&1
done
echo "Done. Note that some of these changes require a logout/restart to take effect."
#!/usr/bin/env bash
# To run this, you must download & install the latest Xcode App and the latest Commandline Tools
# https://developer.apple.com/xcode/
# https://developer.apple.com/downloads/
# Ask for the administrator password upfront
sudo -v
# Install Homebrew
# ----------------------------------------------------------------------
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# Install Homebrew Formulas:
# git, node.js, node package manager
brew install git
brew install node
brew install webkit2png
# Install Native Apps
# ----------------------------------------------------------------------
brew tap phinze/homebrew-cask
brew install brew-cask
# Make /Applications the default location of apps
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
function installcask() {
if brew cask info "${@}" | grep "Not installed" > /dev/null; then
brew cask install "${@}"
else
echo "${@} is already installed."
fi
}
installcask textmate2
installcask app-cleaner
installcask dropbox
installcask firefox
installcask github
installcask google-chrome
installcask open-office
installcask skype
installcask the-unarchiver
installcask u-torrent
installcask vlc
# Install Gems Tools
# ----------------------------------------------------------------------
# Update Gem
sudo gem update --system
# Install Compass
sudo gem install compass
# Install Jekyll
sudo gem install jekyll
# Install Zurb Foundation
sudo gem install zurb-foundation
# Remove outdated versions from the cellar
brew cleanup
# Install of node package manager via Homebrew
# ----------------------------------------------------------------------
curl https://npmjs.org/install.sh | sh
# Point the NODE_PATH to the correct place to find Node modules
export NODE_PATH="/usr/local/lib/node"
# export $PATH since some node modules have execute files
export PATH="/usr/local/share/npm/bin:$PATH"
# LESS CSS Compiler
sudo npm install -g less
# Install SublimeText3
# ----------------------------------------------------------------------
# manual installation. ST3 hasn't been added to Cask yet.
# https://github.com/phinze/homebrew-cask/pull/212
curl -O http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%20Build%203033.dmg
# Mount SumblimeText DiskImage
hdiutil mount Sublime%20Text%20Build%203033.dmg
# Install SumblimeText App
sudo cp -R /Volumes/Sublime\ Text/Sublime\ Text.app /Volumes/Macintosh\ SSD/Applications/Sublime\ Text.app
# Unmount SublimeText DiskImage
hdiutil unmount /Volumes/Sublime\ Text/
# Clean Up
rm -rf Sublime%20Text%20Build%203033.dmg
@pongstr
Copy link

pongstr commented Aug 9, 2016

Nice! 👍

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