Police have charged a man in connection with the death of rapper Mac Miller.

Cameron James Pettit, 28, allegedly supplied Miller with counterfeit oxycodone pills containing fentanyl.

Miller, who once dated Ariana Grande, was found dead of a drug overdose in September 2018 at the age of just 26.

A 42-page criminal complaint unsealed on Wednesday claimed the musician had asked to be given "percs", a prescribed painkiller containing oxycodone.

The complaint detailed Instagram direct messages sent between Pettit and others reacting to Mac's death.

He allegedly said: "I think I should probably not post anything… just to be smart."

(Image: David X Prutting/BFA/REX/Shutterstock)

When asked how he was, Pettit allegedly responded: "I am not great ... Most likely I will die in jail."

Mac, whose real name was Malcolm James McCormick, died on September 7 last year.

Two months after his death the Los Angeles County Coroner's Officer released the official toxicology report that revealed the rapper had fentanyl, cocaine and alcohol in his system when he died.

(Image: Getty )

Ariana Grande posts video of Mac Miller on Instagram account

He had been reported as battling with substance abuse in the past.

"I'm always like, if someone's like 'you wanna try this?' I'm just like 'yeah, sure'. And then it just kinda f**ks you up if you've got a bunch of money because if you try a drug, you like it, you can buy a lot of it," he told Fader magazine in 2016.

Mac and Ariana dated from 2016 but broke up in May 2018.

(Image: GC Images)

After his death she paid tribute to him in her song Thank U Next, which had lines about all her famous exes.

While she was scathing about some, she referred to Mac as an "angel".

The lyric read: "Wish I could say, 'Thank you' to Malcolm/'Cause he was an angel."