Resolving endless Apple Pay add card loop after Time Machine restore

UPDATE:

There appears to be a new directory at /private/var/db/applepay/Library/NFStorage in later versions of macOS. This directory may have to be cleared as well. YMMV.

Original:

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 OS 10.12.5. 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.

There is a workaround for this. 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.

I used this process myself to good success under 10.12.5, on my Macbook Pro. YMMV if you decide to try this on any other version of Mac OS.

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:

# get a root shell
sudo -s
# move the stale files away
mv /private/var/db/applepay/Library/Caches/* ~/.Trash/
mv /private/var/db/applepay/Library/Preferences/* ~/.Trash/
# kill the related cache servers
pkill seld; pkill nfcd;

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, so I imagine the next OS version will have addressed this problem in a more elegant way.

15 Replies to “Resolving endless Apple Pay add card loop after Time Machine restore”

  1. Thanks for writing this up. I had a logic board replaced on my 2016 Touch Bar MacBook Pro and got stuck in the Apple Pay loop after cloning my system back (not Time Machine). Your fix worked on macOS Sierra 10.12.6, with a few differences.

    The first cache could not be found, but my Mac did have a second one. When trying to add a card, I got the first two responses, but on the third one it took a long time to respond. I got what appeared to be a terms and conditions box that was partially blank, which I agreed to. Then it failed with a warning that I didn’t have internet (not true). I tried again, and this time I was able to add a card.

    So, again, thanks!

    1. That’s great to know; thank you for noting the differences in the process. I’m sure this’ll be useful for others in the same situation, who find themselves here on this blog post.

      OTOH, I’m mildly disappointed to learn that Apple hasn’t fixed this bug in 10.12.6. I hope it will be properly addressed in 10.13.

  2. You have saved me. On 10.13.4, and this is still a thing. Had nothing in the cache, but cleared the prefs and killed the daemons, and all was well without any further strange errors or loopsies.

  3. It worked! btw, The first mv command for the Caches was unnecessary for me; the system said there were no files to move. The second mv command was apparently necessary as it completed.

  4. I just ran into this endless add card to Apple Pay loop you describe. I had to reinstall a backup after an Apple repair required they wipe my hard drive. I wish I knew what questions to ask … I’m completely at a loss with the Command Line. I opened Terminal, added each line then hit return … is this correct? I’ve gotten Could someone describe step-by-baby step which I should see? This is what was returned in Terminal after what I thought was entering:

    MyMBP:~ judyb$
    MyMBP:~ judyb$ # get a root shell
    MyMBP:~ judyb$ sudo -s
    Password:
    bash-3.2#
    bash-3.2# # move the stale files away
    bash-3.2# mv /private/var/db/applepay/Library/Caches/*~/.Trash/
    usage: mv [-f | -i | -n] [-v] source target
    mv [-f | -i | -n] [-v] source … directory
    bash-3.2# mv /private/var/db/applepay/Library/Preferences/*~/.Trash/
    usage: mv [-f | -i | -n] [-v] source target
    mv [-f | -i | -n] [-v] source … directory
    bash-3.2# #kill the related cache servers
    bash-3.2# pkill seld; pkill nfcd;

    How much trouble am I in here?

    Help!

    1. Hi!

      You almost got it. You seem to have missed a space in the move commands. There is a space between the asterisk at the end of the first directory parameter, and before the start of ~/.Trash.

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

      The mv terminal command works in this form: mv [source] [target], meaning that it moves files from [source] to [target]. The command above effectively says: “move everything in /private/var/db/applepay/Library/Caches/ to ~/.Trash”. Then it says “move everything in /private/var/db/applepay/Library/Preferences/ to ~/.Trash”.

      If a command worked, you’d see zero output — in Unix, success is typically silent. In your case, it didn’t move anything because you basically didn’t tell it where to move to. By not putting a space between [source] and [target], you tried to tell it to move from [source][target] to ???, and it failed, printing a usage message that tells you, “hey, mv doesn’t work like that”.

      So you could try that again, only with the space added in between. Some other commenters here said the move command for Caches is no longer required and may fail, so take that into account.

      (Unix terminal commands can potentially be dangerous if you are not typing them correctly. If you’re uncomfortable doing this, definitely speak to someone at Apple Support first! They might have a better, easier way to do this, now that more than a year has passed.)

  5. After doing this, when I click on Apple Pay in Settings, I just get the spinning wheel and nothing ever happens. Big Sur, 11.4

  6. 9/19/2023 (macOS Ventura 13.5.2).

    I spoke with Apple Support and they don’t have a freakin clue, as usual. The Support Engineer spoke with Apple employees in their Apple Pay (finance) department who told her that they don’t know anything about Macs. So, she spoke with her senior advisor who told her to speak with the folks in the Apple Pay department. Endless circle-jerk, once again, typical for Apple.

    ‘Nuff said.

    1. Any luck? Same issue and clearing this hasn’t helped, unfortunately.

      Anyone know how to reset this from the commandline?

Leave a Reply to Judy Bell Cancel reply

Your email address will not be published. Required fields are marked *