We investigate the real-time dynamics of the chiral magnetic effect in
quantum electrodynamics (QED) and quantum chromodynamics (QCD). We consider a
field configuration of parallel (chromo)electric and (chromo)magnetic fields
with a weak perpendicular electromagnetic magnetic field. The chiral magnetic
effect induces an electromagnetic current along this perpendicular magnetic
field, which we will compute using linear response theory. We discuss specific
results for a homogeneous sudden switch-on and a pulsed (chromo)electric field
in a static and homogeneous (chromo)magnetic field. Our methodology can be
easily extended to more general situations. The results are useful for
investigating the chiral magnetic effect with heavy ion collisions and with
lasers that create strong electromagnetic fields. As a side result we obtain
the rate of chirality production for massive fermions in parallel electric and
magnetic fields that are static and homogeneous.Comment: 13 pages, 7 figures, revte