How To: Flush DNS Cache on OS X

Most users don’t need to use this command, but it’s very helpful for web developers and network admins to troubleshoot issues with web sites.

This command is run via terminal.

On Leopard (10.6) and Snow Leopard (10.7):

(as root or admin user) dscacheutil -flushcache

On all other version (10.0 – 10.4):

(as root or admin user) lookupd -flushcache

Troubleshooting: Facebook constantly logs out in Safari

**Update** Facebook made updates that fixes this problem.

Troubleshooting: Facebook constantly logs out in Safari

A recent problem has cropped up with the latest version of Safari, 3.2.1 and Leopard 10.5.6. When using Facebook (and possibly other websites such as Last.fm, Gmail, and Twitter, that require authentication to login,) users are finding that they constantly have to re-login again. Of course this gets annoying, and makes accessing those sites nearly impossible. This problem is bad enough that it could even be affecting Firefox users too.

The culprit maybe partially on Facebook’s side as they attempt to combat the recent virus threats and the Leopard/Safari upgrade may be coincidence. Another guess is that Apple changed how multiple programs handle cookies and this is causing issues.

In addition users of iPhones and Adium in conjunction with Facebook seem to have a high chance of having an issue. Using Facebook Chat in Adium and on the iPhone is one of the culprits.

While not a guarantee, here are some possible fixes.

iPhone Users: (may have to be jailbroken to work, I do not have an iPhone to confirm)
1.) Download a terminal program for the iPhone
2.) chown -R mobile /var/mobile/
3.) Power Cycle the iPhone

It seems that the /var/mobile directory is owned by the root user instead of mobile and is causing some of these problems problems.

Adium Users:

  • Disconnect from Facebook or Google Chat before logging in to Facebook or GMail
  • Safari: One or all of these options may be needed to fix

  • Disable Private Browsing (Under Safari Menu, the Private Browsing)
  • Empty Safari Cache (Safari Menu, Empty Cache)
  • Clear Cookies (Safari Menu, Preferences, Security, Show Cookies, Remove All)
  • Reset Safari (Safari Menu, Reset Safari)
  • Reinstall Safari (Download from here)
  • Remove Autofill (Safari Menu, Preferences, Autofill, User Names and Passwords, Edit, remove the site that is having issues)
  • Remove Keychain Entry (Applications/Utilities/Keychain Access. Remove affected site, then go to Menu, Keychain First-Aid, then Repair.)
  • Delete cookie.plist file (/User Home Directory/Library/Cookies/Cookie.plist)
  • Advanced Safari Tip: Enable Developer menu using the command line: defaults write com.apple.Safari IncludeDebugMenu 1 or download Safari Enhancer and clear cookies from this menu.

    Dashboard:

  • Disable any Web Clippings
  • If any of these do work, or you have another solution (or a question about the above,) let me know in the comments and I’ll see what I can do.