Is there a way to configure OSX to always show particular dot files?

I'm familiar with the commands to toggle between showing and hiding hidden files.

Show Hidden Files:

defaults write com.apple.finder AppleShowAllFiles 1 && killall Finder

Hide Hidden Files:

defaults write com.apple.finder AppleShowAllFiles 0 && killall Finder

I also created a quick-click macro to toggle visibility using these commands; however, even this usage is annoying because of frequency. The reason I toggle often is because I prefer not to have all hidden files always visible. Hiding minimizes chance of accidental selections, deletions, etc.

For example, in many of my projects I want to always see .jshintrc and .gitignore files but, do not want .git folders to also be visible.

  • At first I thought that setFile -a V could be used, in conjunction with your defaults write command, but the defaults setting seems to override what setFile does. Best recommendation I can think of is do like ln -s .gitignore "!gitignore" (with hidden files be turned off). You'll see "!gitignore" at the top of your Finder window (if sorting by name), so it will be in a similar place to where ".gitignore" would have been, but it will be visible. – jimtut Jun 13 '14 at 17:02

There is no way to show only some hidden files unless you do as jimtut said and create a link to a file. You can also use Terminal to show the file listing with ls -a.   If the file doesn't need to be hidden with a '.' you can toggle it's visibility with the chflags nohidden fileName command, but this doesn't change visibility for files beginning with a '.'.

  • I knew there was another command to change visibility of a single file, but I couldn't remember chflags. Looks like both chflags and setFile set the same underlying attributes. You can check the attributes with GetFileInfo. Those set/get commands do require the Apple Developer Tools or something. Google it; it's worth it. – jimtut Jun 13 '14 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.