Here we report on the first successful exoplanet transit observation with the Stratospheric Observatory for Infrared Astronomy (SOFIA). We observed a single transit of the hot Jupiter HD 189733 b, obtaining two simultaneous primary transit lightcurves in the B and z bands as a demonstration of SOFIAs capability to perform absolute transit photometry. We present a detailed description of our data reduction, in particular the correlation of photometric systematics with various in-flight parameters unique to the airborne observing environment. The derived transit depths at B and z wavelengths confirm a previously reported slope in the optical transmission spectrum of HD 189733 b. Our results give new insights to the current discussion about the source of this Rayleigh scattering in the upper atmosphere and the question of fixed limb darkening coefficients in fitting routines.