Heterodyne spectroscopy of molecular rotational lines and atomic fine-structure lines is a powerful tool in astronomy and planetary research. One example is the OI fine-structure line at 4.7 THz. This is a main target to be observed with GREAT, the German Receiver for Astronomy at Terahertz Frequencies, which will be operated on board of SOFIA. We report on the development of a compact, easy-to-use source, which combines a quantum-cascade laser (QCL) a compact, lowinput- power Stirling cooler. This work is part of the local oscillator development for GREAT/SOFIA. The QCL, which is based on a two-miniband design, has been developed for high output and low electrical pump power. Efficient carrier injection is achieved by resonant longitudinal-optical phonon scattering. The amount of generated heat complies with the cooling capacity of the Stirling cooler. The whole system weighs less than 15 kg including cooler, power supplies etc. The output power is above 1 mW. With an appropriate optical beam shaping, the emission profile of the laser becomes a fundamental Gaussian one. Sub-MHz frequency accuracy can be achieved by locking the emission of the QCL to a molecular resonance. We will present the performance of the QCL-based source along with some application examples in high-resolution molecular spectroscopy