If a particular folder seems to lose its view options (anything set in View → Show View Options) every time you log out or restart, check if the file
.DS_Store exists in that directory. (Replace
[path] with the path to the directory that doesn’t remember its view options.)
$ cd [path] $ ls -la | grep .DS_Store
Throughout this article, lines that start with
$are commands to be entered in a terminal window. Lines that do not start with
$are the output of the previous command.
If the file doesn’t exist, and isn’t created when you adjust view options for that folder, that’s why the Finder is forgetting its view state. You can create the file yourself, and then the Finder will start saving your settings to it. Run the following command in the same directory:
$ sudo install -o root -g admin -m 0664 /dev/null .DS_Store
This creates an empty file, which should now look like this:
$ ls -la | grep .DS_Store -rw-rw-r-- 1 root admin 0 Aug 19 11:50 .DS_Store
Regular users (with admin privileges) are members of the
admingroup, but not
Change some view settings in that folder, and then check if the size of
.DS_Store has changed:
$ ls -la | grep .DS_Store -rw-rw-r-- 1 root admin 6148 Aug 19 11:50 .DS_Store
If the file size is no longer
0, the Finder is successfully saving your view settings, and from now on they should be honored.
If the size is still
0, make sure the parent directory has write privileges for
admin. If it’s still not changing, try restarting the Finder, then check again.
$ killall Finder
Mountain Lion: desktop icon issue
There’s a similar issue with the desktop view options in Mountain Lion that affects some Macs. When icons are dragged to the desktop, they always move to the top-right as if auto sorting is enabled (regardless of the “Sort By” setting in View Options). If you’ve tried changing that setting to “None” or “Snap To Grid”, but icons are still automatically being sorted, try deleting the
.DS_Store file for the desktop:
$ cd ~/Desktop $ rm .DS_Store
Now log out and back in, and see if the problem has been resolved. If it’s still happening, try restarting your Mac (make sure the “Reopen windows when logging back in” option is not checked). You may need to restart a couple of times to make it stick.
Thanks to Trevor for the one-line command for creating the .DS_Store file with the proper owner/group/permissions.