Context : Ruprecht~147 ( NGC 6774 ) is the closest old open cluster , with a distance of less than 300 pc and an age of about 2.5 Gyr . It is therefore well suited for testing stellar evolution models and for obtaining precise and detailed chemical abundance information . Aims : We combined photometric and astrometric information coming from literature and the Gaia mission with very high-resolution optical spectra of stars in different evolutionary stages to derive the cluster distance , age , and detailed chemical composition . Methods : We obtained spectra of six red giants using HARPS-N at the Telescopio Nazionale Galileo ( TNG ) . We also used European Southern Observatory ( ESO ) archive spectra of 22 main sequence ( MS ) stars , observed with HARPS at the 3.6m telescope . The very high resolution ( 115000 ) and the large wavelength coverage ( about 380-680nm ) of the twin instruments permitted us to derive atmospheric parameters , metallicity , and detailed chemical abundances of 23 species from all nucleosynthetic channels . We employed both equivalent widths and spectrum synthesis . We also re-derived the cluster distance and age using Gaia parallaxes , proper motions , and photometry in conjunction with the PARSEC stellar evolutionary models . Results : We fully analysed those stars with radial velocity and proper motion/parallax in agreement with the cluster mean values . We also discarded one binary not previously recognised , and six stars near the MS turn-off because of their high rotation velocity . Our final sample consists of 21 stars ( six giants and 15 MS stars ) . We measured metallicity ( the cluster average [ Fe/H ] is +0.08 , rms=0.07 ) and abundances of light , \alpha , Fe-peak , and neutron-capture elements . The Li abundance follows the expectations , showing a tight relation between temperature and abundance on the MS , at variance with M67 , and we did not detect any Li-rich giant . Conclusions : We confirm that Rup 147 is the oldest nearby open cluster . This makes it very valuable to test detailed features of stellar evolutionary models .