4

I have a folder on my Mac that I will set up to git-sync with a folder on my web server. I’d like to be able to see the .htaccess file in this folder without having to unhide hidden files all over the system. Is that possible?

I’m using Mac OS X 10.6.8 (Snow Leopard).

(Mike Scott mentioned in How to show hidden files and folders in finder? that this might not be possible to show only specific files/folders that start with a dot but it would be nice with a definite answer – and instructions for how to do it, if it is indeed possible.)

2
  • I'm assuming you're not using the commandline? You should get start using it ls -la and you're good to go :)
    – napcae
    Commented Nov 6, 2013 at 12:42
  • I do :), especially when I’m working with things related to the site, but just as often I’m in Finder and it’d be convenient to see certain dot-files there too. Commented Nov 11, 2013 at 13:55

5 Answers 5

13

One way to get around this would be to create a symbolic link to .htaccess and call it something without a dot. For example:

$ cd site_root
$ ln -s .htaccess htaccess

Then you can open htaccess from Finder and you'll actually be editing the .htaccess file.

(You could even make the second command ln -s .htaccess " .htaccess", which would visually look like .htaccess but be visible because of the leading space.)

6
  • Great workaround since the answer to the title's question was no. Commented Nov 6, 2013 at 12:45
  • 1
    You can also link it to something that looks like a dot; I use ,htaccess (etc.), but you could play games with unicode if you really, really wanted to.
    – alexis
    Commented Nov 6, 2013 at 16:11
  • 1
    or use a hardlink (ln .htaccess htaccess) instead of a soft link... It would be less visible that it is a link, but in some case it's preferable. But in all case, BE CAREFUL. I'd be very worried (and not at all surprised) that doing this could lower the security of the website... you really need to dig info about this before you use that solution at all (either symlink/other name/hard link/etc)! Commented Nov 6, 2013 at 17:06
  • @OlivierDulac, you make a good point. Ensure that apache doesn't serve the htaccess file (or whatever the link's called), to do so might be a security risk.
    – joerick
    Commented Nov 6, 2013 at 17:14
  • Oliver, since this is on my local machine I could just tell git to exclude the link from synching to the server, thanks for the legitimate warning though :-). Commented Nov 11, 2013 at 13:58
3

If you do not wish to use a symbolic link (which is a good workaround), as mentioned in another answer, you can use the free app invisibliX to toggle the visibility of hidden files quickly or to hide specific files. You can even set your own keyboard shortcut from System Preferences > Keyboard.

This is easier to use than resorting to the Terminal to change Finder settings back and forth.

If you wish to see hidden files in Open/Save dialogs, pressing Cmd+Shift+. (dot/period) would toggle the visibility of files.

1
  • Yes, I saw the cmd+shift+. tip when I was searching for a solution to this, it’s really handy (I already started using it). Thanks for the tip :-). Commented Nov 11, 2013 at 14:00
2

Nope. That's a feature.

Either you show all files starting with dots or you hide them all.

chflags hidden myFile can make hide a file but not unhide files hidden because of the dot.

0

I just created this one-liner bash script that creates symbolic links for all dot-files in your home directory. Note that it attempts to create a directory at ~/Dotfiles:

cd ~; mkdir Dotfiles; for f in .*; do ln -s $f Dotfiles/${f:1}; done; rm Dotfiles/DS_Store;

Just paste the line into the Terminal and press Enter.

-1

But if you don't want to use any additional software and don't want to leave your hidden file(s) or folder(s) visible or yet don't want to have to fixe a specific path every time your change your web dev directory and so on,

In a terminal :

defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder

to edit the hidden file

and then

defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder

after editing!

You can create a doubleclic script launcher with Scripteditor e.g.:

do shell script "defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder"

and export it as Application

2
  • 'without having to unhide hidden files all over the system'
    – grg
    Commented May 4, 2014 at 5:37
  • oooooooopsssss! Commented May 7, 2014 at 23:55

You must log in to answer this question.

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