MacOS – Set Default Finder View and Arrange By Options

findermacos

My goal is to set system-wide default Finder view options. In List view, I want Arrange By Kind and Sort By Name.

enter image description here

I set these options in View Options and click Use as Default for new windows. I have tried to clear the .DS_Store hidden files through the following terminal commands:

sudo find / -name .DS_Store -delete; killall Finder

and

sudo find / -name ".DS_Store" -depth -exec rm {} \;

All the view settings seemed to be updated in the Finder windows except for Arrange By Kind.

How do I set system-wide default Finder view options in List view to Arrange By Kind and Sort By Name?

My Mac

Best Answer

I can submit to you this partial answer, which achieves some of what you want, but not all. No matter what combinations I attempted, Arrange By refuses to take on any initial default value other than None. I tried for a couple of hours to solve this one, but gave up. However, I thought you might still benefit from what I did manage to achieve.

The following steps set all folders to list view, and sort by Kind. Although you wanted to have them sorted by Name and arranged by Kind, in the absence of being able to set a default value for Arranged By, what I found was that sorting them by Kind will do just that, whilst using the filename for secondary sorting. That is, the files will be listed by file type, such as JPEGs, TIFFs, MP4s, etc., but within each group of, say, JPEGs, the files will be sorted by name.

1. Backup com.apple.finder.plist

cp ~/Library/Preferences/com.apple.finder.plist ~/Desktop

2. Set top-level defaults using the defaults command

Default to list view:

defaults write com.apple.finder FXPreferredViewStyle Nlsv

Default Arrange By flags that don't seem to be effective:

defaults write com.apple.finder FXArrangeGroupViewBy kind
defaults write com.apple.finder FXPreferredGroupBy kind
defaults write com.apple.finder "FK_ArrangeBy" kind

3. Use PListBuddy to set nested defaults

/usr/libexec/PlistBuddy -c "Set :\"FK_StandardViewSettings\":ExtendedListViewSettingsV2:sortColumn kind" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :\"FK_DefaultListViewSettingsV2\":sortColumn kind" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ExtendedListViewSettingsV2:sortColumn kind" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ListViewSettings:sortColumn kind" ~/Library/Preferences/com.apple.finder.plist

/usr/libexec/PlistBuddy -c "Add :\"FK_StandardViewSettings\":ExtendedListViewSettingsV2:arrangeBy string kind" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Add :\"FK_DefaultListViewSettingsV2\":arrangeBy string kind" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Add :StandardViewSettings:ExtendedListViewSettingsV2:arrangeBy string kind" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Add :StandardViewSettings:ListViewSettings:arrangeBy string kind" ~/Library/Preferences/com.apple.finder.plist

/usr/libexec/PlistBuddy -c "Set :\"FK_StandardViewSettings\":ExtendedListViewSettingsV2:arrangeBy string kind" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :\"FK_DefaultListViewSettingsV2\":arrangeBy string kind" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ExtendedListViewSettingsV2:arrangeBy string kind" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ListViewSettings:arrangeBy string kind" ~/Library/Preferences/com.apple.finder.plist

I initially had the first four set to name in an attempt to achieve the original objective. Upon failure, I set them to all to kind to achieve the result I described.

Ignore any Entry Already Exists reports when running these commands.

4. Clear the .DS_Store files

sudo rm /.DS_Store
find ~ -name .DS_Store -type f -delete

5. Restart cfprefsd and Finder

killall cfprefsd
killall Finder

That's the best I can achieve for now. Hopefully, someone else can build on my answer and give us the missing piece.