Method for producing an optical system having at least two separate optical components (10, 11) and at least one optical connection between the two optical components (10, 11), comprising the following steps: a) providing a first optical component and a second, separate optical component, the first optical component having a first beam profile and the second optical component having a second beam profile; b) designing the optical system while specifying an arrangement of the first optical component and the second optical component and the form and target position of a first beam-shaping element and a second beam-shaping element, the first beam-shaping element being fixedly connected to the first optical component and the second beam-shaping element being fixedly connected to the second optical component, with the first beam-shaping element being configured to modify the first beam profile and the second beam-shaping element being configured to modify the second beam profile, in such a way that, after positioning the first optical component and the second optical component, an optical coupling is formed between the first optical component and the second optical component; c) producing the first beam-shaping element and the second beam-shaping element using a three-dimensional direct-writing lithography method in situ at the target position, whereby a first optical component supplemented by the first beam-shaping element and a second optical component supplemented by the second beam-shaping element are obtained; and d) positioning and fixing the first optical component supplemented by the first beam-shaping element and the second optical component supplemented by the second beam-shaping element on a common base plate, whereby the optical system is obtained. a) providing a first optical component and a second, separate optical component, the first optical component having a first beam profile and the second optical component having a second beam profile; b) designing the optical system while specifying an arrangement of the first optical component and the second optical component and the form and target position of a first beam-shaping element and a second beam-shaping element, the first beam-shaping element being fixedly connected to the first optical component and the second beam-shaping element being fixedly connected to the second optical component, with the first beam-shaping element being configured to modify the first beam profile and the second beam-shaping element being configured to modify the second beam profile, in such a way that, after positioning the first optical component and the second optical component, an optical coupling is formed between the first optical component and the second optical component; c) producing the first beam-shaping element and the second beam-shaping element using a three-dimensional direct-writing lithography method in situ at the target position, whereby a first optical component supplemented by the first beam-shaping element and a second optical component supplemented by the second beam-shaping element are obtained; and d) positioning and fixing the first optical component supplemented by the first beam-shaping element and the second optical component supplemented by the second beam-shaping element on a common base plate, whereby the optical system is obtained.