The walls on the sides and back of my fireplace are plaster on masonry. How can I attach baseboards to these walls? I tried bonding with HMA but eventually that just peels the paint off.
Paint difficulties can be resolved by scraping and priming with a shellac or oil based primed. I prefer the polyurethane based construction adhesives for strength and toughness. Their down side is cure time (overnight)
Another scheme would be to cut back the plaster to 75% of the baseboard height with a diamond blade in an angle grinder (yes, very messy: floor to ceiling tarping, shop vac.. ) Then place 1x or thicker wood and blue screw (one brand of masonry screws are blue and need only a pilot hole (also comes in counter sinkable flat heads))(Tapcon brand, GRK and Spax are also good) it to masonry. Overfill with setting joint compound to flush surface. Nail baseboard normally.
Not afflliated with either company. Have used both.
If by HMA you mean Hot-Melt Adhesive, that stuff is for arts & crafts, not construction.
You should be using construction adhesive.