The effect of a magnetic field on the enhancement of the efficiency of terahertz (THz) generation on the surface of narrow-gap semiconductors is analyzed. A novel small-size THz generator is proposed. It consists of two permanent magnets with opposite magnetization placed on a yoke forming Kittel structure. The construction provides magnetic field concentration in the active zone of a semiconductor placed closely on top of the magnets. Its capabilities of converting femtosecond pulses of the first and second harmonics of an erbium fiber laser are investigated by THz time-domain spectrometer. $n$ -InAs and $n$ -InSb semiconductors in the magnetic field of 0.8 T prove to be the best THz generators at 775- and 1550-nm pump wavelengths correspondingly.