I am trying to sign in to iCloud on a new Mac, and Apple asked for a six-digit verification code. It is supposed to appear on my iPhone automatically, but nothing comes through. I have checked that both devices use the same Apple Account.
What can I do when the code never arrives?
First check on the iPhone: Settings → [your name] → Sign-In & Security → Two-Factor Authentication. Make sure the trusted phone number is correct and can receive SMS. Codes can be sent to a trusted device *or* a trusted number — tap 'Send Code' or 'Get a Verification Code' there to generate one manually.
If the device is offline, the push prompt will not arrive. Make sure the iPhone has internet access, then try again. Check that 'Allow Notifications' is enabled for Settings, because the code prompt is a notification on newer iOS versions.
If none of that works and you have another signed-in Apple device, generate the code there instead. As a last resort, use account recovery at iforgot.apple.com — but note that it can take a day or more, so try every trusted device first.