Working with Gravatars within a localhost development area

You cannot make gravatars work offline (they completely rely on remote service), but you can get rid of erorrs and slowdown when offline by overriding them. You can use get_avatar filter for it.

There is an Airplane Mode plugin for offline WP dev that does this (among other things). You can use that or just check out its implementation.