Using a line of code in Terminal
If you’ve been using Safari’s Private Browsing feature to keep your web-tracks hidden, it might come as a surprise to you that you are leaving a very visible record of the sites you’ve been visiting. This tutorial will show you how to remove those records.
Using a Terminal command, anyone with access to your Mac (local or remote) can get a list of the sites that you’ve visited, even with Safari’s Private Browsing feature enabled.
Safari gives you a bit of a ‘warm and fuzzy’ feeling of private browsing with their explanation of the Private Browsing feature.
Try it out for youself. Enable Private Browsing and go to a couple of web sites.
Now open a Terminal by selecting Applications -> Utilities -> Terminal. Enter the command:
dscacheutil -cachedump -entries Host
You’ll be presented with a list of those same sites you just went to.
That will clear out the Directory Service cache (the location all of that information was being stored). Now run the dscacheutil -cachedump -entries Host command again. This time you’ll get a blank Directory Service cache.