I used to write down everything I heard from the Messenger of Allah ﷺ, wanting to memorize it. Then the Quraysh forbade me, saying, "Do you write down everything you hear from the Messenger of Allah ﷺ? The Messenger of Allah ﷺ is a human being who speaks in anger and in pleasure."So I refrained from writing, and I mentioned this to the Messenger of Allah ﷺ. He pointed with his finger to his mouth and said, "Write, for by the One in whose hand my soul is, nothing comes out of it except the truth."
كنت أكتب كل شيء أسمعه من رسول الله ﷺ أريد حفظه، فنهتني قريش، وقالوا: لا تكتب كل شيء تسمعه من رسول الله ﷺ، ورسول الله ﷺ بشر يتكلم في الغضب والرضا، فأمسكت عن الكتاب، فذكرت ذلك لرسول الله ﷺ، فأومأ بإصبعه إلى فيه، فقال: اكتب، فوالذي نفسي بيده ما يخرج منه إلا حق.
Abu Dawud (3646), Ahmad (6510), and Hakim (1/105-106) all narrated it through the route of Yahya bin Saeed, from Ubaydullah bin Akhnas, from Walid bin Abdullah bin Abu Mughith, from Yusuf bin Mahak, from Abdullah bin Amr, who said, and then mentioned it. Its isnad is sahih. The discussion of it is given at length in the book on knowledge.