Sunan Ibn Majah, Book 33, Hadith 71 (In-Book) ⓘ
It was narrated from Ibn Abbas that the Messenger of Allah said: "Whoever learns about the stars, he learns a branch of magic; the more he learns (of the former) the more he learns (of the latter)."
حَدَّثَنَا أَبُو بَكْرٍ، حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ، عَنْ عُبَيْدِ اللَّهِ بْنِ الأَخْنَسِ، عَنِ الْوَلِيدِ بْنِ عَبْدِ اللَّهِ، عَنْ يُوسُفَ بْنِ مَاهَكَ، عَنِ ابْنِ عَبَّاسٍ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ " مَنِ اقْتَبَسَ عِلْمًا مِنَ النُّجُومِ اقْتَبَسَ شُعْبَةً مِنَ السِّحْرِ زَادَ مَا زَادَ " .
also referenced under: Hadith 3726 (Reference) & Volume 5, Book 33, Hadith 3726 (DarusSalam)