MacOS – How to set a default folder when opening Finder

defaultsfindermacos

I am new on MacOS, would like to set a default folder to open Finder, instead of Recent items folder.

I tried:

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

But didn't worked…

Is there a way to do it?

Best Answer

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.