An in situ, real-time ellipsometer has been developed to be integrated in the first wall of a tokamak. This ellipsometer allows one to measure deposition and erosion of test surfaces exposed to the tokamak plasma. The design is optimized for resistance against high heat loads and large magnetic fields. The instrument is separated into two compartments, one at atmospheric pressure and water-cooled, housing electronic components and devices to generate and detect polarized light, and one at vacuum, holding the sample to be exposed to the tokamak plasma. The ellipsometer has been calibrated and tested in laboratory plasmas and its integration in the TEXTOR tokamak has been demonstrated.