Last active
May 25, 2021 07:35
-
-
Save yibojiang/5c83e4f06c738c2fc484a8f0fd7d7ba7 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/sh | |
# reinstate the Anywhere setting in Gatekeeper | |
sudo spctl --master-disable | |
# 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 | |
# Disable the warning when changing a file extension | |
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false | |
# setup system preference | |
echo "Enable highlight hover effect for the grid view of a stack (Dock)" | |
defaults write com.apple.dock mouse-over-hilte-stack -bool true | |
echo "Show indicator lights for open applications in the Dock" | |
defaults write com.apple.dock show-process-indicators -bool true | |
echo "Allow quitting Finder via ⌘ + Q; doing so will also hide desktop icons" | |
defaults write com.apple.finder QuitMenuItem -bool true | |
echo "Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)" | |
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 | |
echo "Avoid creating .DS_Store files on network volumes" | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
echo "Disable auto-correct" | |
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false | |
echo "Enable AirDrop over Ethernet and on unsupported Macs running Lion" | |
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true | |
echo "Disable the “Are you sure you want to open this application?” dialog" | |
defaults write com.apple.LaunchServices LSQuarantine -bool false | |
echo "Show all filename extensions in Finder" | |
defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
# When performing a search, search the current folder by default | |
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" | |
# Display full POSIX path as Finder window title | |
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true | |
echo "Show Path bar in Finder" | |
defaults write com.apple.finder ShowPathbar -bool true | |
echo "Show Status bar in Finder" | |
defaults write com.apple.finder ShowStatusBar -bool true | |
echo "Expand save panel by default" | |
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true | |
# 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 | |
# Disable “natural” (Lion-style) scrolling | |
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false | |
# 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 | |
# Disable auto-correct | |
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false | |
# Finder: show hidden files by default | |
defaults write com.apple.finder AppleShowAllFiles -bool true | |
# Finder: show all filename extensions | |
defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
# Keep folders on top when sorting by name | |
defaults write com.apple.finder _FXSortFoldersFirst -bool true | |
# Avoid creating .DS_Store files on network or USB volumes | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
defaults write com.apple.desktopservices DSDontWriteUSBStores -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 | |
# 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" | |
defaults write com.apple.finder FXPreferredViewStyle -string "clmv" | |
# Disable the warning before emptying the Trash | |
defaults write com.apple.finder WarnOnEmptyTrash -bool false | |
# Enable AirDrop over Ethernet and on unsupported Macs running Lion | |
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true | |
# Show the ~/Library folder | |
chflags nohidden ~/Library | |
# Show the /Volumes folder | |
# sudo chflags nohidden /Volumes | |
# Speed up Mission Control animations | |
defaults write com.apple.dock expose-animation-duration -float 0.1 | |
# Don’t automatically rearrange Spaces based on most recent use | |
defaults write com.apple.dock mru-spaces -bool false | |
# Prevent Photos from opening automatically when devices are plugged in | |
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true | |
# 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" | |
############################################################################### | |
# Kill affected applications | |
############################################################################### | |
echo "" | |
cecho "Done!" $cyan | |
echo "" | |
echo "" | |
cecho "################################################################################" $white | |
echo "" | |
echo "" | |
cecho "Note that some of these changes require a logout/restart to take effect." $red | |
cecho "Killing some open applications in order to take effect." $red | |
echo "" | |
find ~/Library/Application\ Support/Dock -name "*.db" -maxdepth 1 -delete | |
for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \ | |
"Dock" "Finder" "Google Chrome" "Google Chrome Canary" "Mail" "Messages" \ | |
"Opera" "Photos" "Safari" "SizeUp" "Spectacle" "SystemUIServer" "Terminal" \ | |
"Transmission" "Tweetbot" "Twitter" "iCal"; do | |
killall "${app}" &> /dev/null | |
done | |
# setup bash_profile | |
cat << EOF >~/.bash_profile | |
# Set the colours you can use | |
black='\033[0;30m' | |
white='\033[0;37m' | |
red='\033[0;31m' | |
green='\033[0;32m' | |
yellow='\033[0;33m' | |
blue='\033[0;34m' | |
magenta='\033[0;35m' | |
cyan='\033[0;36m' | |
# Resets the style | |
reset=\`tput sgr0\` | |
# Color-echo. Improved. [Thanks @joaocunha] | |
# arg $1 = message | |
# arg $2 = Color | |
cecho() { | |
echo "${2}${1}${reset}" | |
return | |
} | |
export PATH="/usr/local/bin:~/bin:${PATH}" | |
export PATH | |
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxBxDxCxegedabagacad | |
alias ls='ls -GFhl' | |
export EDITOR='subl -w' | |
EOF | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew tap caskroom/cask | |
brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql qlimagesize webpquicklook suspicious-package quicklookase qlvideo | |
# sublime | |
# ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl | |
# ln -s ~/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl | |
# git config --global core.editor "subl -n -w" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment