The pain in the ribs can be due to multiple causes. Depending on your age these causes need to be ruled out. The most common cause will be osteoporosis
and specifically gives rise to pain when the ribs have become weak and cannot support the muscle attachments . The pull of these muscles specially during exerted inspiration and expiration ( cough
, yawn) can give rise to pain. The first thing to do will be to get a chest xray and meet an orthopaedic surgeon
who in turn can suggest you further tests.