How ‘Silicon Valley’ dealt with the death of one of its most popular actors

Christopher Evan Welch as Peter Gregory in "Silicon Valley."
Jaimie Trueblood/HBO
Warning: If you have not watched the season 2 premiere of "Silicon Valley," there are spoilers ahead.

It was only a matter of time before "Silicon Valley" creator Mike Judge had to figure out how to address Christopher Evan Welch's character Peter Gregory.

The eccentric venture capitalist character on the show quickly became a fan favorite last season thanks to his bizarre antics, like making an investment off the amount of sesame seeds on Burger King buns and the teeny tiny electric car he drives. But sadly, Welch passed away of lung cancer last December in the midst of filming season one.

HBO/"Silicon Valley"
Gregory played a crucial role in the show's plot as he was the lead investor of Pied Piper, the compression start-up the show's main characters are getting off the ground.

The final mention of Gregory on the show was during the season one finale. After Richard (Thomas Middleditch) and the rest of Pied Piper win TechCrunch Disrupt, an annual conference held in San Francisco by website TechCrunch, Richard is told Gregory watched their presentation via a live stream and was "not unpleased."

The big mystery was whether that would be the last viewers would hear from Gregory, or whether he would continue to be referenced remotely in season two. Judge admits he and the writers avoided the topic until they began writing the new season last summer.

On Sunday's season premiere, viewers saw what they decided.

T.J. Miller (L) and Thomas Middleditch.
Frank Masi/HBO/"Silicon Valley"
While awaiting Gregory's return from safari to have a meeting with him, Richard sees a story on the internet that Gregory is dead.

Gregory's head of operations, Monica (Amanda Crew), tells Richard and Pied Piper senior minority owner Erlich Bachman (T.J. Miller) that while on safari a hippo wandered into Gregory's tent. When Gregory ran away from it he passed away as he hadn't run in a very long time. Maybe ever, according to Monica.

Richard gets the news of Peter Gregory's passing.
HBO/"Silicon Valley"
"We talked about different things," Judge told Business Insider about writing off Gregory. "We talked about maybe having him in his nuclear submarine and he's unavailable [the rest of the show]. But we realized the audience knows the actor has passed away so they know the character is never coming back. It was going to seem fake doing it any other way, almost messing with the audience."

Sunday's episode ends with a large funeral for Gregory — inspired by the Steve Jobs' memorial, according to Judge — that included power point slides, a Twitter wall, white doves, and cameos from stars in the valley like Snapchat CEO/co-founder, Evan Spiegel.

HBO/"Silicon Valley"

HBO/"Silicon Valley"

HBO/"Silicon Valley"
"We had to think if there's going to be a big Silicon Valley funeral what would be the quintessential one," the show's co-producer and lead technical consultant Jonathan Dotan told BI. "If you look closely you'll see that we kind of recreated a piece of the Oracle campus for the setting of the funeral."

Judge said he did reach out to Welch's mom before shooting the episode to get her blessing. "It's a tough thing," said Judge looking back. "But we're a comedy, ultimately, and I know that's how Chris would have wanted it."