Saadam Ilyas, of Westend Village, Blanchardstown, Dublin, was charged with weapons offences following an incident on Friday evening.
Gardai arrested him after the complainant and a witness restrained him.
He was held overnight pending his appearance before Judge Treasa Kelly at Dublin District Court on Saturday.
He is accused of possessing the carving knife, capable of inflicting serious injury, as a weapon and producing it during a dispute at the Verdemont apartments in Blanchardstown.
Garda Ian McElroy told Judge Kelly the accused “made no reply to charge”. He objected to bail due to the seriousness of the case.
He alleged that a resident refused him entry to an apartment building because he did not live there. It was alleged the accused shouted at the man, "wait and see what would happen".
The garda said it was reported to gardai that the accused had the knife but hid it in bushes.
It would be claimed that he retrieved it and began running at him, "shouting he was going to cut his throat".
The court heard the accused attacked the man who put up a struggle before they went to the ground.
Garda McElroy said it was witnessed by the complainant's wife and a neighbour who emerged and helped restrain Mr Ilyas. The knife was recovered but CCTV footage from the area has yet to be obtained.
Questioned by defence counsel Kevin McCrave, the garda conceded the accused had no prior criminal convictions.
However, he feared witness intimidation and added that Mr Ilyas lived in another building 100 metres from the scene and the complainant's home.
The garda also told the court the man was unable to attend the bail hearing because he was "still in shock”.
The barrister argued that his client would abide by strict bail conditions and asked the judge to note these were allegations at this stage.
He submitted that the case relied on the alleged injured party's statement and that his client had the presumption of innocence and bail.
Judge Kelly was concerned he lived close to the alleged injured party, but counsel said his client would move into a hostel in the city centre to "alleviate fears".
She told Ilyas he faced very serious charges, but she held that conditions could deal with the matter.
Granting bail in his bond of €300, Judge Kelly warned him he must stay out of Blanchardstown and the D.15 area except for court appearances.
He had to give gardai his phone number and be available to answer a call at all times.
He must have no contact with witnesses and sign on daily at Pearse Street Garda station in the city centre.
Judge Kelly ordered him to appear at Blanchardstown District Court on May 10 for directions from the Director of Public Prosecutions to be obtained.
Legal aid was granted after the court heard he was unemployed and applying for social welfare.
Mr Ilyas has not yet indicated a plea and spoke only to confirm he understood the bail terms.