Many factors...
Check what bit rate the music is. iTunes now uses 256kbps ad the standard and these files sound awesome.
It also could be that.....
Different devices have different characteristics (almost their own EQ) that makes music files sound different.
I have had nothing but excellent results from any MacBook headphone port. It usually depends on the equipment (headphones, sound system, etc) that is receiving the output from the headphone port.