A court heard the alleged victim (24) is still being treated in hospital for her injuries.
McMahon was granted bail on assault and weapons charges but ordered to stay out of the entire city centre while the DPP's directions are awaited.
The accused, with an address at Cushlawn Drive, Tallaght, appeared in Dublin District Court charged in connection with the incident off Pearse Street on December 1.
He is charged with assault causing harm to Christina Joyce and unlawful possession of a Stanley knife at Trinity Court, Spring Garden Lane.
He is also facing a further count of possessing the same blade at the same location the following day.
Objecting to bail, Det Gda Niall O'Reilly said he arrested McMahon at 11.35am on Sunday December 2 and took him to Pearse Street Garda Station, where he was later charged.
Det Garda O'Reilly said the assault happened outside a drug treatment clinic at 11am.
It would be alleged that the accused produced a Stanley blade and proceeded to assault Ms Joyce, "cutting her once on the face and once on the arm, cutting a main artery".
The following day, the defendant was arrested at the same location and was allegedly "trying to conceal a Stanley knife".
The court heard Ms Joyce was in hospital, but was living in hostels in the city centre.
Asked if the accused had any reason to be in the area, Det Garda O'Reilly said McMahon was attending drug rehabilitation in Crumlin and had family living in that area.
The judge asked if the defendant had a passport, to which McMahon replied: "I usually keep it on me, but it's at home in my briefcase."
The garda told Judge Cormac Dunne he was satisfied that the accused resided at his given address at Cushlawn Drive.
Defence solicitor Edward Bradbury applied for bail on the accused's behalf.
Judge Dunne granted bail in McMahon's own bond of €300, on condition that he signs on daily at Tallaght Garda Station and surrenders his passport.