While rebuilding I prefer as much verbose automation as possible.
2014-10-29 This gist is too big, see https://github.com/NoteHub/osx
Read this document through and fork/use the good parts to your preferences.
Save the following commands as system-preferences.sh
and run bash system-preferences.sh
###############################################################################
# General #
###############################################################################
echo Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0.02
echo Set a shorter Delay until key repeat
defaults write NSGlobalDomain InitialKeyRepeat -int 12
echo Add a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
echo Show the ~/Library folder
chflags nohidden ~/Library
echo Store screenshots in subfolder on desktop
# defaults write com.apple.screencapture location -string "$HOME/Desktop"
mkdir ~/Desktop/Screenshots
defaults write com.apple.screencapture location ~/Desktop/Screenshots
echo "Setup computer name"
sudo scutil --set ComputerName "DarthVadersLaptop"
sudo scutil --set HostName "DarthVadersLaptop"
sudo scutil --set LocalHostName "DarthVadersLaptop"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "DarthVadersLaptop"
echo "tame the aspd process"
# to reenable, sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.apsd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.apsd.plist
echo "Disable the 'Are you sure you want to open this application?' dialog"
defaults write com.apple.LaunchServices LSQuarantine -bool false
echo "Disable Notification Center and remove the menu bar icon"
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
echo "Disable auto-correct"
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
echo "Show percentage in battery status"
defaults write com.apple.menuextra.battery ShowPercent -string "YES"
defaults write com.apple.menuextra.battery ShowTime -string "NO"
echo "Fix fonth smoothing"
defaults -currentHost write -globalDomain AppleFontSmoothing -int 0
echo "Enable repeat on keydown"
defaults write -g ApplePressAndHoldEnabled -bool false
echo "Use current directory as default search scope in Finder"
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
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 "Set a blazingly fast keyboard repeat rate"
defaults write NSGlobalDomain KeyRepeat -int 0.02
echo "Set a shorter Delay until key repeat"
defaults write NSGlobalDomain InitialKeyRepeat -int 12
echo "Show the ~/Library folder"
chflags nohidden ~/Library
echo "Disable rubberband scrolling"
defaults write -g NSScrollViewRubberbanding -bool false
echo "Disable dashboard"
defaults write com.apple.dashboard mcx-disabled -boolean YES
echo "Move dock to left side of screen"
defaults write com.apple.dock orientation -string left
echo "Hide dock automatically"
defaults write com.apple.dock autohide -boolean true
echo "Show all filename extensions in Finder"
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
echo "Expand save panel by default"
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
echo "Expand print panel by default"
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
echo "Avoid creating .DS_Store files on network volumes"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
echo "Disable the warning when changing a file extension"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
echo "Require password after a minute after sleep or screen saver begins"
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 60
echo "Use list view in all Finder windows by default"
echo "Four-letter codes for the other view modes: icnv, Nlmv, Flwv"
defaults write com.apple.finder FXPreferredViewStyle -string "Nlmv"
echo "Remove default text from basic screen saver"
defaults write ~/Library/Preferences/com.apple.ScreenSaver.Basic MESSAGE " "
echo "Disable sound effect when changing volume"
defaults write -g com.apple.sound.beep.feedback -integer 0
echo "Disable user interface sound effects"
defaults write com.apple.systemsound 'com.apple.sound.uiaudio.enabled' -int 0
echo "Set system sounds volume to 0"
defaults write com.apple.systemsound com.apple.sound.beep.volume -float 0
###############################################################################
# Trackpad, Mouse, Keyboard, Gestures #
###############################################################################
echo "Enable tap to click (Trackpad)"
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
echo "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
echo "Follow mouse when zoomed in"
defaults write com.apple.universalaccess closeViewPanningMode -int 0
echo "Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)"
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
echo "Tap with two fingers to emulate right click"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
echo "Disable three finger drag"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -bool false
echo "Disable automatic rearrangement of spaces based on most recent usage"
defaults write com.apple.dock mru-spaces -bool false
###############################################################################
# Activity monitor #
###############################################################################
echo "Sort Activity Monitor results by CPU usage"
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
defaults write com.apple.ActivityMonitor SortDirection -int 0
echo "Kill affected applications, so the changes apply"
for app in Safari Finder Dock Mail SystemUIServer; do killall "$app" >/dev/null 2>&1; done
After that, you have to do some settings manually.
I'm scripting the homebrew options below and will post bash soon.
these settings did not have effect when using defaults write
The software selected is software that is "tried and true" --- software I need after any fresh install. I often install other software not listed here, but is handled in a case-by-case basis.
-
Browsers
- [Chrome via cask] I recommend using profiles in Chrome
- Firefox
- Webkit
-
Development
-
Utilities
- iStat Menus (Show resource usage on menu bar)
- Boxcryptor Classic (Encrypts cloud data)
- Google Drive (Stores cloud data)
- GeekTool (Display system log on desktop)
- GrandPerspective (Display disk usage)
- Hosts Editor (Lock out unfriendly hosts)
- Little Snitch (No unknown background traffic)
- Quicksilver (Nice macro app)
- Skype (Phone pals)
- VPN (My favorite VPN provider)
- Filezilla (FTP/SCP gui)
- VLC (Play any video)
-
Virtualization
- VirtualBox (installed via Cask)
- Docker (installed via brew)
- Vagrant (installed via Cask)
#Xcode Command Line Tools
Xcode > Preferences > Downloads > Command Line Tools
#Homebrew
Homebrew comes with a very simple install script. When it asks you to install XCode CommandLine Tools, say yes. Open Terminal and run the following command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
Once complete you should see;
==> Installation successful!
==> Next steps
Run `brew doctor` before you install anything
Run `brew help` to get started*
brew install caskroom/cask/brew-cask
Databases are installed later.
brew install ack autojump automake colordiff curl git git-flow \
hub icoutils imagemagick libmemcached memcached openssl ossp-uuid qt \
readline redis tmux wget libxml2
brew cask install anvil
brew cask install atom
brew cask install authy-bluetooth
brew cask install awareness
brew cask install bartender
brew cask install battery-guardian
brew cask install github
brew cask install google-chrome
brew cask install joinme
brew cask install iterm2
brew cask install virtualbox
brew cask install rescuetime
brew cask install rubymine
brew cask install satellite-eyes
brew cask install sidestep
brew cask install sonos
brew cask install steam
brew cask install vagrant
brew cask install vagrant-manager
When you have difficult binaries to install like OpenCV or other complicated, it might be easier to install them to a vagrant box. Sometimes you just want to `sudo apt-get install python-opencv python-numpy`.
If you don't want to pollute your OS X with tons of libraries and binaries(e.g. ruby gems/python packages), you can always spin up a vagrant box. For example you could have one vagrant box for running Python software and another for Ruby.
#Shell
Install custom .dotfiles anc customize this
git clone git@github.com:kevinelliott/.dotfiles.git ~/.dotfiles
~/.dotfiles/install.sh
Update .bash_profile
echo 'source ~/.dotfiles/base.sh' >> ~/.bash_profile
#Git
ssh-keygen -t rsa -C "darthvader@empire.org"
# Copy ssh key to github.com
subl ~/.ssh/id_rsa.pub
# Test connection
ssh -T git@github.com
# Set git config values
git config --global user.name "Darth Vader"
git config --global user.email "darthvader@empire.org"
git config --global github.user darthvader
git config --global github.token your_token_here
git config --global core.editor "subl -w"
git config --global color.ui true
mkdir -p ~/bin && ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
Run Sublime Text 3
and access the console via the CTRL + ``` shortcut or the
View > Show Console` menu.
import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
See https://sublime.wbond.net/installation for more information. Their site has a note that this install code will change for each new release, so it would be good to check once in a while.
BracketHighlighter CoffeeScriptHaml
git clone git://github.com/buymeasoda/soda-theme.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Theme\ -\ Soda
git clone git://github.com/chriskempson/textmate-tomorrow-theme.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Color\ Scheme\ -\ Tomorrow
Sublime Text > Preferences > Settings - User
{
"close_windows_when_empty": true,
"color_scheme": "Packages/Color Scheme - Tomorrow/Tomorrow-Night-Eighties.tmTheme",
"draw_indent_guides": false,
"font_face": "Mensch",
"font_size": 18,
"highlight_modified_tabs": true,
"show_tab_close_buttons": false,
"tab_size": 2,
"spell_check": false,
"theme": "Soda Light.sublime-theme",
"word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?"
}
[
{ "keys": ["super+b"], "command": "expand_selection", "args": {"to": "brackets"} },
{ "keys": ["super+f"], "command": "show_panel", "args": {"panel": "replace"} },
{ "keys": ["super+alt+f"], "command": "show_panel", "args": {"panel": "find"} }
]
git clone git@github.com:bytestudios/sublime-snippets.git "/Users/DarthVader/Library/Application Support/Sublime Text 2/Packages/Byte"
I need to try installing docker on Mac including VirtualBox and boot2docker dependencies with one simple command.
https://github.com/thlorenz/docmac
curl -L https://raw.github.com/thlorenz/docmac/master/bin/docmac.sh | sh
Boot2docker is a small script that helps download and setup a minimal Linux VM that will be in charge of running docker daemon.
brew install docker boot2docker
boot2docker init
boot2docker up
and check out your new environment.
export DOCKER_HOST=tcp://localhost:4243
docker version
brew install mysql
brew pin mysql
# Copy launch agent into place
mkdir -p ~/Library/LaunchAgents && cp /usr/local/Cellar/mysql/VERSION/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
# Edit launch agent and set both keepalive and launch at startup to false
vi ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
# Inject launch agent
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
# Set up databases to run as your user account
unset TMPDIR && mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
# Start mysql
start mysql
# Secure mysql
/usr/local/Cellar/mysql/VERSION/bin/mysql_secure_installation
brew install postgres --no-ossp-uuid
brew pin postgres
# Initialize db if none exists already
initdb /usr/local/var/postgres
# Create launchctl script
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/VERSION/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
# Edit launchctl script (set to not start automatically and keepalive false)
subl ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
# Inject launchctl script
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
# Start PostgreSQL
start pg
Include and test better Ruby install here;
https://gorails.com/setup/osx/10.10-yosemite
brew uninstall v8
gem uninstall libv8
brew install v8
gem install therubyracer
gem install libv8 -v 3.16.14.3 -- --with-system-v8
brew tap homebrew/dupes
brew install libxml2 libxslt libiconv
gem install nokogiri -- --with-iconv-dir=/usr/local/Cellar/libiconv/VERSION/
brew install -v https://raw.github.com/cliffrowley/homebrew/patched_qt/Library/Formula/qt.rb --HEAD --without-ssse3
gem install capybara-webkit -v '0.9.0'
-
Productivity app for creating gesture/mouse/keyboard shortcuts to about any action you can imagine. For example I have binded 3 finger tap to middle click, 3 finger left/right swipes to changing browser/text editor tabs and more.
I tested moom as an alternative, but BetterTouchTool has more features and is free. BetterTouchTool also ships with a killer feature that I've missed most from Ubuntu(Gnome), check it out: https://www.youtube.com/watch?v=wUeKjkpBdCo
-
Instead of
cd ~/code/personal/projects/secret/mysecretproject
you can justz mysecretproject
. Fast.Install:
mkdir ~/.bin cd ~/.bin git clone https://github.com/rupa/z.git echo "source ~/.bin/z/z.sh" >> ~/.zshrc
-
Useful helper commands/aliases for git and others
-
When you have difficult binaries to install like OpenCV or other complicated, it might be easier to install them to a vagrant box. Sometimes you just want to
sudo apt-get install python-opencv python-numpy
.If you don't want to pollute your OS X with tons of libraries and binaries(e.g. ruby gems/python packages), you can always spin up a vagrant box. For example you could have one vagrant box for running Python software and another for Ruby.
-
"Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications."
"Docker enables apps to be quickly assembled from components and eliminates the friction between development, QA, and production environments. As a result, IT can ship faster and run the same app, unchanged, on laptops, data center VMs, and any cloud."
-
OS X ships with its own Python but I recommend installing Python with brew. It makes setupping pip and other Python tools easier.
Make sure that your brew installed Python is the one that you are running. If
which python
outputs/usr/bin/python
. Then you need to add/usr/local/bin
to your PATH before/usr/bin
.After installing virtualenv with pip, install also mkvirtualenv for your convenience.
-
Install with: pkg, brew or nvm. I prefer brew.
-
Postgres
Mavericks does not have Postgres installed by default anymore: http://stackoverflow.com/questions/19611505/does-postgresql-exist-on-os-x-mavericks
I think using http://postgresapp.com is the preferred way. Using brew might be fine also, don't know.
-
Windows virtual machines with IE versions
Microsoft provides virtual machines for different Windows + IE version combinations for your testing convenience.
A lot of this information comes from these sources:
- https://gist.github.com/kevinelliott/0726211d17020a6abc1f
- https://gist.github.com/kimmobrunfeldt/350f4898d1b82cf10bce
- http://scouringmacbook.blogspot.fi/
- https://gist.github.com/1623487/88bb6766048133d2a68403d02531ce62c46ad404
- https://gist.github.com/jimmynotjim/7617722
- https://gist.github.com/benfrain/7434600
- http://coolestguidesontheplanet.com/install-and-configure-wget-on-os-x/