The headphone jack of my 2017 iMac 27” got loose and pushed in too deep. After my initial panic, the fix was easy: (1) Use a screw just big enough to get hold of the jack to pull it back into position. The Bic pen trick didn’t do it for me. Be careful not to damage the contacts (I don’t know how though). (2) Put a *tiny* drop of super glue between the back of the housing of the computer and the jack. Initially the right channel was only connecting if I pulled down the headphone jack, so I put a tiny piece of paper underneath it. Now it’s working fine. I put a 10 cm extension cable between my headphones and iMac, so I don’t have to put the iMac’s jack under any more stress and risk getting it loose again. Now I only need to find a way to play music through the speakers while that extension cable is plugged in.