In my (albeit limited) experience bears are more shy than aggressive. That said, if you happen to come across an aggressive bear, this Expedition Portal article argues that bear spray is a better bear deterrent than bullets.

The article cites research indicating that in 133 bear attacks in which bear spray was used for self defense, three minor injuries result. In 269 attacks in which a gun was used for self defense, 17 people died. Yikes.

ExpeditionPortal: Why Some Say Spray