Bear spray works, will generally be more "accurate" for the average person to use than a gun (unless you go to the range frequently), and will actually be on your person when you need it. It's great stuff. Living in the Yukon bush, I have bears around my place frequently and don't worry about it, they have just walked on by. Bears need a reason to do something, unless they're habituated or have some problem. That typically makes bears in wild areas "safer" than those in popular parks, etc. where they may have a learned behaviour.
On the other hand, here's what they can do. My GF cabin outside Dawson City got hit a couple weeks ago, we just got back from boarding it up. Note, those 2x4 are snapped off or split lengthwise, not a big deal for a big grizzly. No attractants in the cabin, it might have learned the behaviour somewhere it got lucky.
If you're travelling through Canada, don't worry about firearms. We have lots, they're legal, but treated as tools - not around unless there is a defined need. For instance, since the bear that did this damage might have still been around and proven to be aggressive, I did bring a 12 gauge/slugs to hang on the wall while we did repairs, but that's a real exception. Normally, I don't bother with a gun, too heavy and awkward. Handguns are ineffective except in the very large calibres mentioned by someone earlier, which take lots of practice - and then you need to carry around a few extra pounds! Dealing with most bears is common sense. Be reasonable, use the precautions mentioned by several people above, and have fun!
Oh, and as for climbing trees, I'd be surprised if you can climb a tree (or hang food in one) that a bear can't deal with. Here's a mother with 2 cubs up some willows to eat leaves in the spring. No way I could have climbed that. There may be exceptions, but...
She never turned her head as we went right on by, just kept munching. As long as we weren't an apparent threat, it was all good.