I'm trying to play my electric guitar through my IMAC. I have external speakers connected to my Headphones socket in the back of my MAC, how do i go about playing my guitar through those speakers?

I have an adapter that will allow me to connect my guitar cable into one of the sockets in the back of my MAC but i'm not sure how to set it all up and what socket to plug what into???

thanks in advance