Alexandria shooter James Hodgkinson lived out of a gym bag and hung out for the past month-and-a-half at the YMCA across the street from where he opened fire, according to a report Wednesday.

Bill Euille, former mayor of Alexandria, said he and Hodgkinson spoke almost every day at the Y, where the alleged gunman would be seen working on his laptop, the Washington Post reported.

“He was a very friendly person. But what I did notice about this gentleman is he’d open up his gym bag and in it, he had everything he owned,” said Euille, who lost his re-election bid last year. “He was living out of the gym bag. That, and he sat in the Y’s lobby for hours and hours. Outside of myself, I don’t think he knew anyone else in town.”

Euille goes to the Y to work out around 7 or 7:30 a.m. every day and usually saw Hodgkinson, 66, showering.

The ex-mayor said the two never spoke about political issues but that sometimes, when President Trump came on the lobby TV and others commented about it, “he indicated he agreed with us,” he said.

Hodgkinson hit Euille up for potential jobs in the area but when opportunities came his way, Hodgkinson admitted he didn’t have a bachelor’s degree.

Euille said he traded texts with the Y’s manager, who said Hodgkinson had been at the gym and left around 7 a.m.Wednesday — before walking over to the nearby baseball field, where he opened fire on Republican lawmakers who were practicing for the upcoming congressional game.

Another Y member, Stephen Brennwald, said he’d regularly see Hodgkinson at the gym — but never in workout gear.

“He never worked out. He never talked to anybody. He never did anything,” Brennwald told the Washington Post. “He’d just sit there and stare at his laptop.”

And when he wasn’t on his laptop, he’d stare out the window — at Eugene Simpson Stadium Park, where the shooting occurred.

A source close to the Hodgkinson family told The Post that Hodgkinson moved to the area in April — without ever telling his wife, daughter or grandson why.

“James had just packed up and moved out,” said the source, who last saw James’ daughter, Tasha, during a visit to Belleville, Ill., in April. “[His wife] Sue didn’t know what was going on or why.”

“I thought he was maybe gay or left for another woman. I mean, who gets up and just walks away after 30 or so years of marriage? It’s just crazy,” the source added.

The family friend, who requested anonymity in order to speak candidly about the situation, recounted several instances in which she and Hodgkinson had battled on Facebook over their conflicting political beliefs.

“I actually blocked him on Facebook, it was so bad,” the source said, recalling an instance in May when they got into a fight over a Facebook post by Hodgkinson’s wife about millennials and personal responsibility.

Hodgkinson had responded to the source’s comment with a Photoshopped picture of President Trump looking demented, accusing the president of behaving like an adolescent in office.

“This guy would not let up,” the source said.

Tasha, Hodgkinson’s adopted daughter, had moved back to the US from Germany earlier this year — months before her father abruptly relocated to Washington.