Will Smith let loose after his first relationship came to an end.

The actor details the split in his new memoir “Will,” admitting he went through a promiscuous phase in his early life following the breakup from his first girlfriend, Melanie.

“I desperately need relief,” he recalled. “But as there is no pill for heartbreak, I resorted to the homeopathic remedies of shopping and rampant sexual intercourse.

“Up until this point in my life, I had only had sex with one woman other than Melanie. But over the next few months, I went full ghetto hyena.”

Will Smith was just 16 when he fell in love with Melanie, but the romance ended when he discovered she had been unfaithful to him while he was out on a two-week tour.

Although the pair reconciled, they could never move on from her infidelity.

While sleeping around was immediate relief for Will, who is married to actress Jada Pinkett Smith, it had lasting consequences: “I had sex with so many women, and it was so constitutionally disagreeable to the core of my being, that I developed a psychosomatic reaction to having an orgasm.

“It would literally make me gag and sometimes even vomit. In every case, though, I hoped to God this beautiful stranger would be ‘the one’ who would love me, who would make this pain go away.

“But invariably, there I was, retching and wretched. And the look in the eyes of the woman even further deepened my agony.”