How to set a default folder when opening Finder

Finder → Preferences (⌘,) → General and set ‘New Finder windows show’, either pick from the list or choose Other and specify a custom path.

You don't need to set the key manually using Terminal, but you should be able to with this:

defaults write com.apple.finder NewWindowTargetPath -string "file://localhost/Users/path/to/folder/"

Note the trailing slash at the end and the use of localhost, both of which are how Finder writes the key itself.


A couple of quick things that may help if you are looking to set Desktop or Documents as the default for Finder...

Set Desktop as Default:

defaults write com.apple.finder NewWindowTarget -string "PfDe"

Set Documents as Default:

defaults write com.apple.finder NewWindowTarget -string "PfDo"