The "open with" context menu shows twice the same item fix

If you get something like:



The following command could help this issue, just copy paste this whole line into your terminal

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -all s,l,u; killall Finder

Add "Recent Applications" icon to the dock, and disable windows animation

1) To add Recent Applications icon to the dock, open Terminal and copy paste following:

defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' && killall Dock


Don't forget to check recent Items settings in System Preferences>General

2) To disable windows animation, open Terminal and copy paste following:
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool NO

How to get md5 hash of files in current directory

The following command pretty useful when you need to get a md5 of specific files e.g. only video files in the current dir.

find * -iname '*.mp4' -exec md5 '{}' \; >output.txt


Does anybody know what '{}' \; means?

How to hide a folder in Finder

In order to hide a folder in Finder, open Terminal and write following:


setfile -a V /path/to/folder

Or

chflags hidden /path/to/folder


To unhide:


setfile -a v /path/to/folder

Or

chflags nohidden /path/to/folder

Update locate database on OS X (updatedb)

In order to update "locate" database on OS X, some people suggest to create a symlink:


sudo ln -s /usr/libexec/locate.updatedb /usr/local/bin/updatedb

However, this method can create an erroneous output if you are in directory with a specific permission e.g.

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
find: .: Permission denied


The better method would be to create a bash script /usr/local/bin/updatedb:

  #!/bin/bash
  pushd . > /dev/null
  cd /usr/libexec
  echo "Updating locate database..."
  sudo ./locate.updatedb
  echo "Updating complete!"
  popd > /dev/null


Make it executable: sudo chmod +x /usr/local/bin/updatedb

Now you can just run «sudo updatedb», in order to update «locate» database.