18

I'm not entirely sure how I get into this situation, but fastlane_tmp_keychain-db becomes my default keychain after a build, and I can't figure out how to un-set it.

enter image description here

enter image description here

There are no options here to change the defaults. Why did fastlane do this and how do I undo it?

It's definitely the default; I get "Spotlight wants to use fastlane_tmp_keychain-db" on login.

Roman Starkov
  • 59,298
  • 38
  • 251
  • 324
  • Similar problem here; https://github.com/fastlane/fastlane/discussions/17002. I too cannot get rid of this keychain and it is affecting my apps. – JimmyDeemo Jul 25 '21 at 14:13
  • 1
    Did you manage to get the "login" back in the Default section? Mine seems to be stuck in the Custom section, not sure if that will cause any trouble.... – Esben von Buchwald Feb 23 '22 at 10:36

3 Answers3

17

Took me longer to figure out than I care to admit, so I'm documenting this here also for my own reference...

Open up Keychain Access, select the fastlane_tmp_keychain-db keychain on the left and then select Edit > Delete.

Delete Keychain

In the following dialog choose "Delete Keychain File" to permanently delete it.

Confirmation Dialog

This should fix it.

The fastlane_tmp_keychain-db shouldn't be there in the first place. It's temporary and supposed to be deleted automatically after the lane is executed. However, judging by the number of reports and questions on this topic lately, it seems to have broken recently. Deleting it should fix any issues you might have with your Mac and shouldn't affect your Fastlane project in any way.

André
  • 2,101
  • 20
  • 23
11

It happened for me as well and I found this thread. But the solution of André does not work for me, Delete action is grayed out and disabled in Edit menu.

But I found another solution to delete the keychain:

fastlane run delete_keychain name:fastlane_tmp_keychain-db

and set login keychain as default again:

security default-keychain -s ~/Library/Keychains/login.keychain-db

you may have to restart 'Keychain Access' to show changed default keychain

sbejga
  • 157
  • 2
  • 7
  • Oh god! Thanks :) This was the best answer. Why would fastlane do such a stupid thing?! – Matin Zadeh Dolatabad Feb 21 '23 at 08:07
  • a note for any poor soul that has `login` keychain deleted because of this stupid bug on fastlane, just create a new Keychain, name it `login` and press ok button, it will bring back all the keys. For some reason the `login.keychain-db` was nowhere to be found on my machine but creating a new one with the same name automagically brought it back. – Stathis Ntonas Aug 31 '23 at 20:13
4

Finally managed to get rid of if using the following. Add this to your fastlane file;

desc "delete created keychain"
   lane :delete_chain do
delete_keychain(name: "fastlane_tmp_keychain-db")
end

Then run sudo fastlane delete_chain. Note: This will (likely) destroy anything that has been saved into the keychain while it was considered the default. Therefore consider backing it up first.

JimmyDeemo
  • 313
  • 1
  • 15