How to get all options for com.apple.finder.plist in ~/Library/Preferences? how people know what's possible to be changed via CLI in OSX / macOS if com.apple.finder.plist is a binary file and calling cat command for that file  shows only a binary gibberish output?

cat ~/Library/Preferences/com.apple.finder.plist


I've found great option in macOS Sierra:


  Keep folders on top when sorting by name


What's the name of it's defaults write so that I can add it into my settings script?

Basically instead of guessing I would like to know where to find all possible options. Does Apple provide it somewhere? I know this site but it's not up to date...
To read/write .plist files, use the defaults command.

The key that gets set when checking the [√] Keep folders on top when sorting by name check box under Advanced in Finder Preferences is named: _FXSortFoldersFirst 

To set this in Terminal (or script) use the following command:

defaults write com.apple.finder _FXSortFoldersFirst -bool YES


To unset, use the following command:

defaults write com.apple.finder _FXSortFoldersFirst -bool NO


Note that in previous OS versions, Finder needed to be restarted using killall Finder to have some settings, when changed by defaults, work properly. In macOS 10.12, this is not necessary for this particular setting, however the Finder window does need to be refreshed by some means, e.g. toggling from list view to icon view and back.



If you want to toggle between List view and Icon view in the bash script vs. using killall Finder after using defaults write ..., use the following code block:

osascript &lt;&lt;END
tell application "Finder"
    set theWindows to every Finder window
    repeat with i from 1 to number of items in theWindows
        set this_item to item i of theWindows
        set theView to current view of this_item
        if theView is list view then
            set current view of this_item to icon view
        else
            set current view of this_item to list view
        end if
        set current view of this_item to theView
    end repeat
end tell
END


Note: This method may not work with all setting changes made to Finder, although it works for _FXSortFoldersFirst, nonetheless killall Finder may be required for some settings. It's just to early to tell with macOS 10.12.