Unable to add Apple Pay wallet after restoring a Time Machine Backup

I had a new 2016 MacBook Pro with Touchbar that had ApplePay on it and was being backed up via TimeMachine. 1 month after I had it (December 23rd), it completely died and Apple issued a full refund. I placed a new order and received a new 2016 MacBook Pro with Touchbar. After I restored the TimeMachine backup, I went to ApplePay to add my cards again (via system preferences). I got a message stating "Apple Pay is already configured on this disk for another Mac." It gives the option to "Reset Apple Pay and Add Card...". After I click that and authenticate with my password or fingerprint (tried both ways many times), it goes back to the same popup so it looks like it's not fully resetting ApplePay.


Basically, I need to kill the existing ApplePay data and reset it so I can use it on the new Mac. This is a bug and I had a ticket opened but the senior technician has stopped responding to me because he does not have a solution.

The Apple ticket is *******

<Personal Information edited by Host>

MacBook Pro (15-inch, Late 2016), macOS Sierra (10.12.4)

Posted on Apr 21, 2017 1:13 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 28, 2018 4:14 PM

To resolve this issue, it requires a little bit of playing with the filesystem so here's the obligatory warning: THIS IS MESSING WITH SYSTEM FILES. DO NOT EXECUTE ANY OF THIS IF YOU ARE NOT SURE WHAT YOU ARE DOING AND DO NOT HAVE A BACKUP OF YOUR DATA. TYPING THE COMMANDS WRONG MAY CAUSE SERIOUS ISSUES WITH YOUR MAC.

If you recently had your Macbook Pro (Touch Bar) repaired (possibly with a logic board replacement), and restored from Time Machine backup, you might find yourself unable to use Apple Pay on Mac. The system will report “Apple Pay is already configured on this disk for another Mac” and ask you to “Reset Apple Pay and Add Card”. If you try to do so by authorizing it using fingerprint or password, it will immediately drop you back to the original “Apple Pay is already configured on this disk for another Mac” prompt, going back into this cycle ad infinitum.

The issue is that there is an Apple Pay cache at /private/var/db/applepay/ on the system that has been invalidated, but it seems to be unable to delete this cache properly. It will keep trying to refresh this cached data, and fail to do so.

To fix this endless loop, you need to first clear out all the files (but not the folders) inside /private/var/db/applepay/. Open Terminal.app and enter the following commands:

In the terminal app, type the following commands:

sudo -s

mv /private/var/db/applepay/Library/Caches/* ~/.Trash/

mv /private/var/db/applepay/Library/Preferences/* ~/.Trash/

pkill seld; pkill nfcd;

Explanation of the commands:

sudo -s (will actually get you to a root shell - note that the password is the same as your system)

mv commands (will moves the staled files in the trash)

pkil commands (will kill the related cache servers)

Then:

– Wait a few seconds for the relevant servers to boot themselves up again. Then, go back to System Preferences, hit Add Card…

– It will fail the first time with a mysterious error. That’s fine. Hit Add Card again…

– On this second try, it will say “Apple Pay is already configured on this disk for another Mac”.

– When you hit “Reset Apple Pay and Add Card” for the final time, it will actually break past the loop, and you will get to re-enter your Apple Pay card information without further issue.

It’s a relatively easy fix. Let's hope that Apple will fix this in an upcoming MacOS release.

45 replies
Question marked as Top-ranking reply

Jan 28, 2018 4:14 PM in response to rumpadunk

To resolve this issue, it requires a little bit of playing with the filesystem so here's the obligatory warning: THIS IS MESSING WITH SYSTEM FILES. DO NOT EXECUTE ANY OF THIS IF YOU ARE NOT SURE WHAT YOU ARE DOING AND DO NOT HAVE A BACKUP OF YOUR DATA. TYPING THE COMMANDS WRONG MAY CAUSE SERIOUS ISSUES WITH YOUR MAC.

If you recently had your Macbook Pro (Touch Bar) repaired (possibly with a logic board replacement), and restored from Time Machine backup, you might find yourself unable to use Apple Pay on Mac. The system will report “Apple Pay is already configured on this disk for another Mac” and ask you to “Reset Apple Pay and Add Card”. If you try to do so by authorizing it using fingerprint or password, it will immediately drop you back to the original “Apple Pay is already configured on this disk for another Mac” prompt, going back into this cycle ad infinitum.

The issue is that there is an Apple Pay cache at /private/var/db/applepay/ on the system that has been invalidated, but it seems to be unable to delete this cache properly. It will keep trying to refresh this cached data, and fail to do so.

To fix this endless loop, you need to first clear out all the files (but not the folders) inside /private/var/db/applepay/. Open Terminal.app and enter the following commands:

In the terminal app, type the following commands:

sudo -s

mv /private/var/db/applepay/Library/Caches/* ~/.Trash/

mv /private/var/db/applepay/Library/Preferences/* ~/.Trash/

pkill seld; pkill nfcd;

Explanation of the commands:

sudo -s (will actually get you to a root shell - note that the password is the same as your system)

mv commands (will moves the staled files in the trash)

pkil commands (will kill the related cache servers)

Then:

– Wait a few seconds for the relevant servers to boot themselves up again. Then, go back to System Preferences, hit Add Card…

– It will fail the first time with a mysterious error. That’s fine. Hit Add Card again…

– On this second try, it will say “Apple Pay is already configured on this disk for another Mac”.

– When you hit “Reset Apple Pay and Add Card” for the final time, it will actually break past the loop, and you will get to re-enter your Apple Pay card information without further issue.

It’s a relatively easy fix. Let's hope that Apple will fix this in an upcoming MacOS release.

Feb 23, 2018 12:56 PM in response to rumpadunk

(sorry for the duplicate, but didn't see the above, so this is same info).

Got the actual solution from Apple Support engineers. As always, backup and be careful.


Open the terminal and type the following commands:

sudo -s

(enter your admin account password)

mv /private/var/db/applepay/Library/Caches/* ~/.Trash/

mv /private/var/db/applepay/Library/Preferences/* ~/.Trash/

pkill seld; pkill nfcd;

Restart, and Apple Pay was working and able to add cards!

Jun 8, 2017 12:06 PM in response to rumpadunk

Ok, I've just spent a significant amount of time over the past two days trying to fix this issue. No success, but have some interesting information that could be helpful.


1)

Setting up a separate user account does not solve the problem on the second user account. Therefore problematic files are not in the user directory.

Setting up a separate partition with a blank installation of macOS does fix the issue on that partition, however as soon as you restore from your backup (e.g. Time Machine), the backed-up Apple Pay preference files are written over the working ones and the problem will occur.


2)

I have had a play around with the following files, with varying degrees of success.

You will need to enable hidden files. Some files require you to add yourself to the permissions to read/write them. Some require system integrity protection to be turned off to edit.


Replacing the /System/Library/PreferencePanes/Wallet.prefPane file with a fresh copy from the new macOS installation does not help. In fact at one point it stopped it working entirely.


I tried deleting the card files (these are stored in /Users/~/Library/Passes), this didn't seem to help either.

I also tried replacing them with the files from the fresh-install partition. This also didn't work.


There are some Apple Pay files in the following protected & hidden folder (/private/var/db/applepay/Library/Preferences).

If you delete com.apple.seld.plist, then restart, Apple Pay then allows you to reset and add a card. The problem then returns next time you restart, when you are again unable to add any further cards without resetting Apple Pay. I also noted that deleting this file stopped the card I did manage to add working on Safari (I tried to buy something from the Apple Store with Apple Pay, and it just didn't come up when I clicked the Apple Pay button). The file isn't re-generated by the computer at any point after deleting. Perhaps this is the problem file that needs to be regenerated after a restore?


I tried replacing all the replacing all the files I could find with the fresh ones from the working macOS partition, this simply generated error messages when trying to load the Apple Pay preference pane.


I get the feeling I'm missing some files!


I think apple needs to introduce a new Reset Apple Pay button, which completely restores all of the files associated with Apple Pay (and the secure element). Then after restoring from a backup it can be reset.


This surely will be a big problem as more people experience issues with their machines (e.g. the logic board failure I had), and are required to restore from a backup.


PLEASE HELP APPLE!

Jul 27, 2017 10:30 AM in response to Nick Brook

I discovered that you only need to create the directory structure:


cd /private/var/db
sudo mv -i applepay applepay.old
sudo mkdir -p applepay/Library/Preferences
sudo chown -R _applepay:_applepay applepay
sudo pkill seld
sudo pkill nfcd


You may not even need to do that; just steps 1,2,5,6. When I did try to add a card, I had to log back in to my iCloud account after which everything worked. Based on the contents of the only file in a default install of Sierra, com.apple.stockholm.awd.plist, having macOS create a new file looks like a better idea.

Jun 11, 2017 3:22 AM in response to rumpadunk

FIXED / SOLUTION


Spent some more time today trying to fix the problem, it does appear to be a problem with the applepay folder I mentioned in my previous post, and some permissions which are required to use it.


Seemingly, I have now completely fixed the problem and I'm able to add new cards and use Apple Pay.


Here is how I did it in detail. Follow at your own risk!


  1. Backup (backup backup backup!) - you shouldn't lose your data, but backup anyway!
  2. Open a copy of these instructions on your phone, or print a copy.
  3. Install a new copy of Sierra on a separate partition:
    1. If you do not have a copy of the macOS Sierra installation package, go to App Store and download it.
    2. Make sure you have at least 25GB disk space free.
    3. Launch disk utility (command+space, then type "Disk Utility")
    4. Click the main disk above the Macintosh HD partition (e.g. APPLE SSD AP102J Media)
    5. Click partition
    6. Click the + at the bottom of the pie chart, change the size to something sensible (e.g. 25-50GB, depending on available space), name the partition something like "TempOS"
    7. Click Apply and wait for it to process
    8. Once downloaded, run the macOS Sierra installation file (located in Applications folder after it has downloaded). Select "Show All Disks" and select the new partition you created.
    9. Run the installation until it starts into the new OS and asks you to complete the setup. You can just make up a user account (e.g. testuser), no need to sign into iCloud or set up Touch ID or anything.
    10. You must complete the setup steps until you can see the desktop.
  4. Restart the machine into recovery mode

    From the new macOS installation, shut down, and then restart with command+R held down to boot into recovery mode.

  5. Launch terminal in recovery (Utilities→Terminal)
  6. Turn system integrity protection OFF (this allows you to modify the files which are causing a problem).

    In terminal type the following (without quotes) "csrutil disable", press enter.

  7. Change the startup disk back to "Macintosh HD" from the new "TempOS" partition. Otherwise each time you restart it will boot the new macOS installation.

    The startup disk picker is in Utilities→Startup Disk.

  8. Restart the machine, login to your account as usual
  9. Download a copy of Carbon Copy Cloner. You can use the free trial, or buy the app (it's great!)

    Download Carbon Copy Cloner | Carbon Copy Cloner | Bombich Software

  10. Show hidden files
    1. Open terminal (command+space, then type "terminal")
    2. Copy and paste (without quotes) "defaults write com.apple.finder AppleShowAllFiles YES", press enter
    3. Restart finder by either holding option and right clicking on the finder icon clicking "relaunch", or type "killall Finder" into terminal.
  11. Launch Carbon Copy Cloner and create a new task. Move to right of screen part of screen.
  12. Launch a Finder window and move to left of screen (side by side with Carbon Copy Cloner)
  13. In Finder, press "Go>Computer" in the menu bar, and open the new partitioned drive ("TempOS"), here you should see all the hidden folders (including one called Private)
  14. Navigate though the folders as follows: Private → var → db
  15. In the db folder, there should be a folder with a red no entry sign called "applepay". Drag this folder into the "Source" box in Carbon Copy Cloner.
  16. Go back to finder and click Go>Computer, then "Macintosh HD", then navigate to the same folder (Private → var → db). This time drag and drop the "applepay" folder into the "Destination" box in Carbon Copy Cloner.

    Double check you are copying FROM the new copy on TempOS to the broken copy on Macintosh HD.

  17. DO NOT be tempted to not use Carbon Copy Cloner and drag and drop / copy & paste the folder instead, this DOES NOT maintain the permissions required for the Apple Pay process to use the folder and it will not work. Only Carbon Copy Cloner copies while maintaining the required permissions.
  18. Make sure you have a backup of your applepay folder (you don't need it but just to be safe):
    1. You may already have a backup of this folder if you have backed up before you started. Alternatively:
    2. Either run another Carbon Copy Cloner task from the Macintosh HD applepay folder to a safe folder (e.g. Desktop). You can then turn SafetyNet OFF.
    3. Or: leave the SafetyNet feature ON. This will make carbon copy cloner create a backup of the file in a folder called CCC_SafetyNet
    4. Again, DO NOT simply drag and drop / copy & paste the applepay folder, it will lose the special permissions.
  19. Run the Carbon Copy Cloner task by clicking "Clone".
  20. Once completed, restart the system into recovery (hold down command+R when the computer is booting up)
  21. Turn System Integrity Protection back ON
    1. In recovery launch terminal (Utilities→Terminal)
    2. Type (without quotes) "csrutil enable", then press enter
    3. Restart the machine, login
  22. Test Apple Pay
    1. Launch system preferences, and go to "Wallet & Apple Pay". Try to add a card there. You may need to sign into iCloud again.
    2. If it works → 🙂, if it doesn't → 😢
  23. Put everything back together again...
  24. Turn hidden files back off
    1. Launch terminal (cmd+space, then type "terminal"),
    2. Copy and paste (without quotes) "defaults write com.apple.finder AppleShowAllFiles NO", press enter
    3. Restart finder by either holding option and right clicking on the finder icon clicking "relaunch", or type "killall Finder" into terminal.
  25. Delete the new macOS partition
    1. Launch disk utility (command+space, then type "Disk Utility")
    2. Click the main disk above the Macintosh HD partition (e.g. APPLE SSD AP102J Media)
    3. Click partition
    4. Click the new "TempOS" partition part of the pie chart
    5. Click the "-" button
    6. Click "Apply"
    7. CONFIRM that it is NOT "Macintosh HD" you are deleting!! → Click "Partition"
  26. Presto, you're done!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Unable to add Apple Pay wallet after restoring a Time Machine Backup

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.