How to wire ceiling fan motor to supply but light kit to switch?
Your wiring should look something like this.




The incoming "hot" connects to the black motor lead of the fan, and the white wire of the switch loop.  This white wire will be marked at both ends, with black tape, marker, or paint.
Connect the neutral from the feed to the neutral of the fan.
Connect the blue light kit wire, to the black wire coming back from the switch.
Connect all grounds.


This will allow the fan motor to always have power, so it will be controlled by the built in pull switch. The light, on the other hand, will be controlled by the wall switch.



Technically, this is no longer a code approved installation, since there's no neutral at the switch.  However, since you're simply installing a lighting fixture, you're not required to bring the wiring up to current code.