Is there a way to change the order in which the finder alphabetizes?
Unfortunately, no.
Since Mac OS X 10.0 "Cheetah", when sorting items by filename in Finder, files are sorted using the Unicode Collation Algorithm, with an additional specification that numeric substrings are sorted by numeric value, i.e. if multiple files exist whose filenames are of the form xny
, where x
is a susbtring that does not end with a digit, n
is a substring which only consists of digits, and y
is a substring that does not begin with a digit, then each such n
is treated as a numeric value rather than a sequence of bytes, and the files are sorted accordingly. There is no option to disable this "natural canonical sorting", as some refer to it. This is stated officially in Apple's File System Programming Guide for macOS (§ File System Details):
The Finder
Because the Finder is the user’s main access to the file system in macOS, it helps to understand a little about how the Finder presents and works with files.
Filename Sorting Rules
The Finder’s sort order for file and directory names is based on the Unicode Collation Algorithm (Technical Standard UTS #10) defined by the Unicode Consortium. That standard provides a complete and unambiguous sort ordering for all Unicode characters and is available on the Unicode Consortium website (http://www.unicode.org). The Finder alters the default sorting behavior of this algorithm slightly by taking advantage of some sanctioned alternatives, specifically:
- Punctuation and symbols are significant for sorting.
- Substrings of digits are sorted according to their numeric value, as opposed to sorting the actual characters in the number.
- Case is not considered during sorting.
Note that this behaviour is only exhibited by Finder itself. Other programs, such as the plain old BSD ls
that comes packaged with macOS, behave in their own ways; typically, such BSD utilities abide by the Unix-style convention of sorting "lexicographically", i.e. by character encoding value.
Is it possible to have directories appear at the top of a list of files in Finder?
This can be done using the "Arrange/Group by Kind" option, but this then applies to other categories of files as well (e.g. media, documents), not just folders. Note that this does not group them by file extension, but rather into a set of groups defined by Apple.
If you just want folders first, but don't want everything else put into those other groups, then you should set "Group by" to "None", "Sort by" to "Name", and enable the following Finder preference:
- Open Finder.
- Press ⌘+,; or go to [Finder] in the menu bar, then [Preferences...].
- Go to [Advanced] and Enable "Keep folder on top: in windows when sorting by name". (This setting has slightly different names in various versions of macOS, e.g. "Keep folders on top when sorting by name" in macOS Sierra.)
There is no way to sort/group the files by their file extension; setting "Sort by" to "Kind" sorts them according to the same groups that are used if you set "Group by" to "Kind", just without showing the group headings.
As a workaround to both of these issues, you can use an alternative file browser such as Path Finder, which was partially designed to cater to these specific use cases.