Captain Kirk NEVER said "Beam me up, Scotty!" The exact quotes were: "Scotty, beam me up" and "Beam them out of there, Scotty."
The phrase got so popular, however, that James Doohan (1920 - 2005), the actor who played Montgomery "Scotty" Scott in Star Trek, used it as the title of his autobiography.