On July 14, Mr. Friedman showed up for a meet-and-greet with the cast of a second show, “The Bubbly Black Girl Sheds Her Chameleon Skin,” and then went straight to the hospital.

“He said he had H.I.V., he was going to the emergency room, and could I bring him a phone charger,” recalled Daniel Goldstein, a director and writer who also befriended him at Williamstown. “They had caught it at a rather advanced stage, but the drugs were working, and we all thought things were getting better.”

Mr. Friedman, who had health insurance as an employee of the Public Theater, where he was an artist-in-residence and director of an audience engagement program, had known he was H.I.V. positive only since early July, when he was tested by his primary care physician, according to his sister, Marion Friedman Young. He began taking antiretroviral medications that month.

His first hospital stay lasted 10 days, before he was sent home to recuperate. His immune system had been compromised, but his friends and family were hopeful that over time he would make a recovery. By text, he kept friends updated on his progress. By email, he was outlining plans for next summer.

“Every part of me expected him to break through the door of City Center, with an IV hooked up to his arm, shouting something, and the fact that he didn’t frightened me, a lot,” Mr. Pinkleton said. “This was somebody I’d watched be an aircraft carrier for 10 years, and he turned into a baby bird.”

On Aug. 19, he was readmitted to NYU Langone Medical Center with acute respiratory distress syndrome (ARDS). He spent the rest of his life in the intensive care unit, intubated and periodically sedated. Family was with him daily; friends visited as much as possible.

When he was awake, he would converse by writing down his thoughts and showing them to visitors. But there were moments of stillness as well. “Often we were just being silent,” Mr. Goldstein said, “holding hands and watching the U.S. Open.”