3

I know I can easily do this via the Finder's toolbar but I'm currently writing a huge shell script that'll set my future Mac up exactly as I want.

So is there any command to do it like the one to set viewing style ?

3

To set a default view style use:

defaults write com.apple.Finder FXPreferredViewStyle icnv|Nlsv|clmv|Flwv

with:

icnv: Icon View
Nlsv: List View
clmv: Column View
Flwv: Cover Flow View

To enable this immediately (which probably is not relevant for your shell script) you have to kill the Finder with killall Finder. Some folders might have a different view style set already (via .DS_Store files) while installation. You have to remove those invisible files to adapt your preferred style.

To deal with the group/arrange/sort settings you have to use PlistBuddy and defaults. The relevant key/sub-keys are FXPreferredGroupBy and StandardViewSettings and therein IconViewSettings, ExtendedListViewSettings and ListViewSettings.

Examples:

Arrange by application:

defaults write com.apple.Finder FXPreferredGroupBy Application

Possible values for defaults are none, date, name, kind, Date Added, Date Created, Application etc.

Arrange by kind:

/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy kind" ~/Library/Preferences/com.apple.finder.plist

Sort by date added:

/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ExtendedListViewSettings:sortColumn dateAdded" ~/Library/Preferences/com.apple.finder.plist

Possible values for PlistBuddy are none, date, name, kind, dateAdded, dateCreated etc.

Some combinations of those settings (view style, arrange by, sort by) aren't possible or don't make much sense (depending on your OS).

0

Edit : I guess I finally found something by looking at the com.apple.finder.plist file!

From http://www.real-world-systems.com/docs/defaults.txt.html, at "finder" :

FXArrangeGroupViewBy = Name;
FXMyDocumentsArrangeGroupViewBy = "Date Last Opened";

I guess it should be something like

defaults write com.apple.finder FXMyDocumentsArrangeGroupViewBy = "Kind"

But nothing works.

  • Nothing works is not a solution. Do write it on correct please. – atilkan Jul 14 '16 at 12:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .