  By means of detailed chemo-photometric models for elliptical, spiral and
irregular galaxies, we evaluate the cosmic history of the production of
chemical elements as well as the metal mass density of the present-day
universe. We then calculate the mean metal abundances for galaxies of different
morphological types, along with the average metallicity of galactic matter in
the universe (stars, gas and intergalactic medium). For the average metallicity
of galaxies in the local universe, we find Z_gal= 0.0175, i.e. close to the
solar value. We find the main metal production in spheroids (ellipticals and
bulges) to occur at very early times, implying an early peak in the metal
production and a subsequent decrease. On the other hand, the metal production
in spirals and irregulars is always increasing with time. We perform a
self-consistent census of the baryons and metals in the local universe finding
that, while the vast majority of the baryons lies outside galaxies in the
inter-galactic medium (IGM), 52 % of the metals (with the exception of the
Fe-peak elements) is locked up in stars and in the interstellar medium. We
estimate indirectly the amount of baryons which resides in the IGM and we
derive its mean Fe abundance, finding a value of X_Fe,IGM=0.05 X_Fe,sun. We
believe that this estimate is uncertain by a factor of 2, owing to the
normalization of the local luminosity function. This means that the Fe
abundance of 0.3 solar inferred from X-ray observations of the hot
intra-cluster medium (ICM) is higher than the average Fe abundance of the
inter-galactic gas in the field.
