Bear spray is usually a better choice, on account of a whole lot of factors. At the very least you should bring both and issue a warning with bear spray.
Edit: how to use bear spray
Also, be aware that the weather is orders of magnitude more likely to kill you than a bear, and avoiding bear encounters is usually fairly easy to begin with. If you're carrying a gun but not a compass, your risk assessment is WAY off.