Mac OS X tricks


  1. How can I make auto-hide/show for the dock faster? (from here)

    defaults write com.apple.dock autohide-time-modifier -int 0;killall Dock
    
  2. open command can let you open file and url in terminal

    open . # will open the current folder in finder
    open ./XXX.md # will open the markdown file with the default editor
    open http://www.baidu.com
    open -a dash # open a application of dash
    oepn *.png # open all the png images
    
  3. say command

    You can let your Mac speaking,

    say "Hello world"
    say -f <file>
    
  4. Setting iterm2

    This setting will let you use the Emacs keybindings.

    Change the keyboard behavior:

    left option ⇒ +ESC
    
  5. How to “Quit” the Finder in OS X Using those commands will be ok:

    defaults write com.apple.finder QuitMenuItem -bool true
    killall Finder
    

    To reverse this action, enter the following command:

    defaults write com.apple.finder QuitMenuItem -bool false
    killall Finder
    
  6. Configure bash and/or vim to execute source ~/.bashrc everytime I finish editing it

    The direct way to do it:

    vim ~/.bashrc && source $_
    

    You can make an alias:

    alias vimbashrc='vim ~/.bashrc && source $_'
    

    This works in bash or zsh. In other shell, you must explicit name .bashrc to source to make it work:

    alias vimbashrc='vim ~/.bashrc && source ~/.bashrc'
    
  7. Force reload all resources(css, js..) of Chrome

    Just press the key of :

    Shift + Command + R