Step 1: Go to https://developer.apple.com and login to your Apple Developer Account.
Step 2: Select Certificates, Identifiers, Profiles
Step 3: Select tab Certificates, then Click (+) to add a new Certificate
Step 4: On Select Type page, select Apple Push Notification service SSL (Sanbox & Production). Then click Continue
Step 5: On this page, select the App ID you want to push notification to. Then click Continue
Step 6: Go to Create a New Certificate
Step 7: Prepare on your Mac (or a computer running MacOS)
You are directed to “Certificate Information”. Please fill out all required information:
Tick on “Saved to disk”. Next, save this file as “app_pushnotification” and then you will get . certSigningRequest file on your Desktop
Step 9: Come back to your account on developer.apple.com. You need to click “Choose file” to upload the app_pushnotification.certSigningRequest file you have just created. Then, click “Continue”.
Then click "Download".
Step 10: After that, double click on the file you have just downloaded, change file’s name as app_pushnotification.cer, move this file to your Desktop and open “Keychain Access”. Now find “app_pushnotification” and “Apple Push Services:<your App ID>” and export these 2 items. Then, save this file as “app_pushnotification” and move to your Desktop. Please note that the file format is (.p12)
Step 11: Generate PEM file
Open Terminal and execute the following steps:
Go to the folder where you downloaded the files, in this case it's the Desktop:
The file app_pushnotification_end.pem is the one you need.