In 1962, shortly after President John F. Kennedy delivered his “We choose to go to the moon” speech declaring that space “deserves the best of all mankind,” Mr. McDivitt was plucked from an Air Force test-flight team to become an astronaut in NASA’s Gemini program.
Three years later, Mr. McDivitt and his best friend, former test-flight pilot Edward H. White II, launched in what NASA called “the program’s most ambitious flight to date,” flying for a record four days, during which White became the first American to walk in space. (A Soviet astronaut walked in space earlier that year.)
The Gemini 4 mission captivated America, with families gathering around their televisions for updates and to eavesdrop as the astronauts checked on their worried but thrilled families on Earth.
“You being good?” Mr. McDivitt asked his then-wife, Patricia, in one exchange.
“I’m always good,” she said. “Are you being good?”
Mr. McDivitt replied: “I haven’t much choice. All I can do is sleep and look out the window.”
But Mr. McDivitt, in getting a few laughs from viewers back home, was underselling just how important — and dangerous — his work was for the space program. The Gemini 4 flight gathered crucial engineering and medical data that NASA scientists used in preparation for the Apollo moon program.
In 1969, Mr. McDivitt was the commander of the Apollo 9 mission, a 10-day flight during which the crew tested a prototype of the lunar module that Buzz Aldrin and Neil Armstrong used to land on the moon — a historic event that overshadowed Mr. McDivitt’s mission.
“I could see why,” Mr. McDivitt said in an oral history of his career that NASA conducted in 1999. “You know, it didn’t land on the moon.”
James Alton McDivitt was born in Chicago on June 10, 1929, and grew up in Kalamazoo, Mich. He enrolled in junior college and then joined the Air Force in 1951 despite never having been on a plane.
“I’d already joined the Air Force, was in the Air Force, was accepted for pilot training before I had my first ride,” Mr. McDivitt said in the oral history. “So, fortunately, I liked it!”
Mr. McDivitt flew 145 combat missions in the Korean War, after which he went to the University of Michigan, where he studied aeronautical engineering and graduated at the top of his class in 1959. There, he met White, who was also an Air Force pilot.
They became test pilots, then astronauts, and then were paired together on the Gemini 4 mission in part because of their tight relationship.
On the morning of June 3, 1965, they arrived at the No. 19 launchpad on Florida’s Cape Canaveral and were strapped into the tiny cockpit.
“The Gemini was very, very tight,” Mr. McDivitt said in a 2019 interview with Astronomy magazine. “It was extremely tight — you couldn’t stretch all the way out. You were in the seat, and that’s where you stayed.”
At 10:16 a.m., Gemini 4 shot into the sky as millions of people watched on television. “Looks like this baby is going,” a CBS television reporter said.
When it was time for White’s spacewalk, the astronauts encountered a hitch — the door was stuck. “Oh my God,” Mr. McDivitt said out loud “It’s not opening!”
He began to wonder what would happen if they got the door open but then couldn’t get it closed to land. (“You’re dead,” Mr. McDivitt predicted in the oral history. “… You’ll burn up on the way down for sure.”)
The door finally opened, and out White went. The astronauts were in awe.
“You look beautiful, Ed,” Mr. McDivitt said on his radio.
“I feel like a million dollars,” White replied.
Gemini 4 splashed down in the Atlantic Ocean off the coast of Florida on June 7. The astronauts were taken aboard an aircraft carrier and congratulated over the phone by President Lyndon B. Johnson. Ticker-tape parades followed.
After flying the Apollo 9 mission, Mr. McDivitt remained with NASA as manager of the Apollo program. He retired from the Air Force and NASA in 1972 as a brigadier general, then entered the private sector.
White was killed in a 1967 fire at Cape Canaveral during preflight tests for the Apollo 1 mission. “My father was absolutely devastated by it,” said Mr. McDivitt’s son Patrick.
Mr. McDivitt’s Gemini 4 flight was notable not just for the data it produced that helped NASA eventually get to the moon. While on board, Mr. McDivitt took photographs of what he initially believed was a UFO.
“I looked outside, just glanced up, and there was something out there,” he said in the oral history. “It had a geometrical shape similar to a beer can or a pop can, and with a little thing like maybe like a pencil or something sticking out of it. That relative size, dimensionally. It was all white.”
The film was examined by NASA, which determined that whatever Mr. McDivitt had seen wasn’t a spacecraft. He later concluded he had probably just seen strange reflections of bolts in the windows.
Still, the UFO world and pop culture could never quite let go of what Mr. McDivitt thought he saw. The astronaut was constantly asked about it.
“I became a world-renowned expert in UFOs,” he joked in the oral history. “Unfortunately.”
The astronaut even appeared as himself on an episode of “The Brady Bunch” in which Peter and Bobby Brady are tricked into thinking they saw a UFO.
Mr. McDivitt’s first marriage, to Patricia Haas, ended in divorce. Survivors include his wife of 37 years, the former Judith Odell; four children from his first marriage, Michael McDivitt, Ann Walz, Patrick McDivitt and Katie Pierce; two stepsons, Joe Bagby and Jeff Bagby; 12 grandchildren; and six great-grandchildren.
In histories of Mr. McDivitt’s triumphs in space, the astronaut often speaks of how difficult it was to get his best friend back in the cockpit after the spacewalk — not because of the hard-to-open door but because the moment was magical for both of them.
“Come on,” Mr. McDivitt said over his radio. “Let’s get back in here before it gets dark.”
His best friend, still bouncing around in space, replied, “It’s the saddest moment of my life.”