Skip to content

Instantly share code, notes, and snippets.



Last active Jul 25, 2018
What would you like to do?
Get Finder to sort like Windows Explorer a la terminal

Get Finder to sort folders first like Windows Explorer a la terminal.

Note: This hack is no longer needed in High Sierra. Just run defaults write _FXSortFoldersFirst -bool true


Results Two things to note:

  • Unfortunately files are sorted by kind first then alphabetically. Check the location of in the screenshot for example. This is as close as I could get it to Windows Explorer for now.
  • I've left folder dropdowns. I think I like folder dropdowns for moving files between subfolders with ease, we'll see.
# Use list view in all Finder windows by default
# Four-letter codes for the other view modes: 'icnv', 'clmv', 'Flwv'
defaults write FXPreferredViewStyle -string "Nlsv"
# Set item arrangement to none (enables folder dropdowns, 'Name' if you want to remove them)
defaults write FXPreferredGroupBy -string "None"
# Sort list view by kind in ascending order (Windows style)
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ExtendedListViewSettings:sortColumn kind" ~/Library/Preferences/
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ExtendedListViewSettings:columns:4:ascending true" ~/Library/Preferences/
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ListViewSettings:sortColumn kind" ~/Library/Preferences/
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ListViewSettings:columns:kind:ascending true" ~/Library/Preferences/
# Sort Folders before files hack (Windows style)
# Backup InfoPlist.strings first if no backup exists
[ -f $FILE.bak ] || sudo ditto $FILE $FILE.bak
# Convert InfoPlist.strings to XML
sudo plutil -convert xml1 $FILE
# Add a space in front of 'Folder' string
sudo sed -i '' 's/g\>Folder/g\> Folder/' $FILE > /dev/null
# Convert InfoPlist.strings back to binary
sudo plutil -convert binary1 $FILE
# Remove all .DS_Store files to reset folder specific view options
sudo find / -name ".DS_Store" -depth -exec rm -f {} \;
# Restart cfprefsd and Finder
killAll cfprefsd
killAll Finder

This comment has been minimized.

Copy link

@nimbling nimbling commented Nov 19, 2015

This performs the "space before folder" hack, does it? Handy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment