Be very careful with volume levels doing anything I am about to suggest. Every time you change something, turn everything all the way down and gradually bring it up. I cannot overstate that - any time you are running different level signals around between gear you need to be careful of input levels.
Ironically this is often easier with PC than mac as well (I do both though).
If your amp has a line in and headphone out, you’re done. All you need is to run the line out from your computer sound card to the line in on the amp and plug your headphones into the amp. You need to be very careful with levels though, and make sure it’s a line out and not a headphone out on your computer. If all you have is a headphone out (i.e. a mac), be extremely careful with the output level on the computer. Start at minimum.
If your amp doesn’t have a line/aux in, you need to buy something. The cheapest option i found was the Vox Amplug:
These are little headphone preamps that plug into the guitar and have an aux in you can run the output from your computer to.
You will probably need to buy some cables to connect it all together as well, and maybe a cable adapter, depending on your amp.