Mac Miller died from a mix of fentanyl and cocaine, according to the Los Angeles County Coroner's Office. The death has been ruled an accidental overdose.

According to TMZ, the coroner's office said the rapper died of "mixed drug toxicity" — referring to the fentanyl and cocaine —and alcohol, too.

Carl Timpone/BFA/REX/Shutterstock

Mac was found dead on Sept. 7 in his home in a Los Angeles suburb. Initial reports pointed toward an alleged overdose. He was 26.

The report said Mac's assistant found him unresponsive on his bed in a "praying position." The assistant described him as being "blue" during the 911 call.

In addition, there was a small cut on the bridge of Mac's nose, and there was blood coming out of one nostril.

When the assistant arrived, there was an empty bottle of alcohol on the nightstand, and there was a bottle of prescription medication in the bathroom. Police also found a rolled up $20 bill with white powdery residue in Mac's pocket.

David X Prutting/BFA/REX/Shutterstock

Despite Mac's struggles with sobriety, the music world was shocked at the death. His ex, Ariana Grande, posted a photo of Mac to her Instagram after the news hit. A week later, on Sept. 14, she broke her silence while sharing a fun video of Mac telling a story, a video taken while they were dating. "I adored you from the day I met you when I was nineteen and i always will. I can't believe you aren't here anymore," she said. "I really can't wrap my head around it. We talked about this. So many times. I'm so mad, I'm so sad I don't know what to do. You were my dearest friend. For so long. Above anything else. I'm so sorry I couldn't fix or take your pain away. I really wanted to. The kindest, sweetest soul with demons he never deserved. I hope you're okay now. Rest."

Mac had struggled with substance abuse in the past. He was arrested in May for driving under the influence and hit and run after allegedly crashing his car and fleeing the scene. TMZ claimed his blood alcohol content was nearly twice the legal limit. And that, the website pointed out, "was well after he fled his crash scene."

According to TMZ, Mac was incredibly courteous when he was arrested and handcuffed on May 17 and allegedly confessed to driving drunk and leaving the scene. "He was the most polite and nice intoxicated person we've ever seen," a source told the website.

"I made a stupid mistake," he told Beats 1 host Zane Lowe on July 23. "I'm a human being. Like, [I] drove home drunk. But it was the best thing that could have happened. … I needed that. I needed to run into that light pole and literally, like, have the whole thing stop."

Mac's arrest came just weeks after he split with Ariana after nearly two years of dating. "Pls take care of yourself," she tweeted after his arrest.