I had this problem. I tried Lauri's solution, and had intermittent success. I found that my particular problem was that I was sometimes running the command from root. Running it from standard permissions proved consistently successful, where running it from root proved consistently unsuccessful.

suggestion on my Mac Mini with success, but it did not work on the macbook pro no matter how many times (or which method I used) to restart Finder. When I used the "boolean" method, it worked for the macbook the first time. The macbook is a 2010 unit, and the mini from 2012, but all that should be only in the OS, and not related to hardware. very odd, but thanks very much for posting both options. I was beginning to drive myself crazy trying to see hidden files on the laptop. I even used "sudo" for the "AppleShowAllFiles" method, thinking it was a permissions thing, but that did not help.