Chemical reactions occurring on surfaces may provide an alternate route to materials beyond traditional methods, e.g. large polymers or compounds that would react further in ambient conditions or lack solubility. Many on-surface reactions yield atomic hydrogen which then desorbs swiftly from noble metals of group 11 (Cu, Ag, Au). Using a porphyrin-related macrocycle, so-called pyrphyrin, also bearing two cyano groups at the periphery, we show that dehydrogenation of the center of the macrocycle leads to selective formation of hydrogen cyanide, created from the rim-cyano groups and the hydrogen of the center imine (=NH). Formally, the surface-remaining reaction product is a dicarbene, bearing two divalent carbon atoms. It reacts readily with Fe atoms at room temperature, unlike its pyrphyrin precursor, which requires annealing for metalation with Fe. The hydrogen cyanide abstraction becomes suppressed when pyrphyrin is metalated with iron atoms, because the absence of the two hydrogen atoms does not allow the tautomerization.