log in to the Apple portal, go to the iPhone preparation section. Create a development certificate for your Mac, register your phone, and create a development profile. Install the profile and certificate on your Mac and the preparation profile on your phone.
While you are logged into the portal, there is documentation that you should take a look at, which explains this a bit more fully - in fact, there is a step-by-step wizard! If you are not a paid developer (i.e. you just registered and downloaded xcode and did not pay Apple for a fee), then development and testing on your device are not available.
source share