{"id":19389799,"url":"https://github.com/toxblh/keychainexportpasswords","last_synced_at":"2026-07-12T02:30:16.393Z","repository":{"id":75974473,"uuid":"154516360","full_name":"Toxblh/KeychainExportPasswords","owner":"Toxblh","description":"🔑 Export you passwords from Keychain to CSV for another password keepers (LassPass, 1Password, BitWarden) works with MacOS Mojave","archived":false,"fork":false,"pushed_at":"2019-07-08T18:12:32.000Z","size":14,"stargazers_count":31,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-07T09:36:13.455Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"AppleScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Toxblh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-10-24T14:32:36.000Z","updated_at":"2024-06-12T08:39:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"436286c0-902e-45c4-8c11-eec821993bca","html_url":"https://github.com/Toxblh/KeychainExportPasswords","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Toxblh%2FKeychainExportPasswords","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Toxblh%2FKeychainExportPasswords/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Toxblh%2FKeychainExportPasswords/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Toxblh%2FKeychainExportPasswords/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Toxblh","download_url":"https://codeload.github.com/Toxblh/KeychainExportPasswords/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240549430,"owners_count":19819137,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T10:17:27.373Z","updated_at":"2026-07-12T02:30:16.348Z","avatar_url":"https://github.com/Toxblh.png","language":"AppleScript","funding_links":["https://www.patreon.com/bePatron?u=9900748"],"categories":[],"sub_categories":[],"readme":"# KeychainExportPasswords\n\nExport you password from Keychain for another password keepers\n\nYou can try:\n- [First version](https://github.com/Toxblh/KeychainExportPasswords/blob/master/README.md#first-version)\n- [Second version](https://github.com/Toxblh/KeychainExportPasswords/blob/master/README.md#second-version)\n\n\u003ca href=\"https://www.patreon.com/bePatron?u=9900748\" align=\"right\"\u003e\n\t\u003cimg src=\"https://c5.patreon.com/external/logo/become_a_patron_button@2x.png\" width=\"160\"\u003e\n\u003c/a\u003e\n\n### Before all \n\u003cimg src=\"https://us.v-cdn.net/5020219/uploads/editor/pc/ibknuc1xo8qz.png\" width=\"450px\" /\u003e\n\n# First version\n\nSteps:\n- You must have TextEdit open on a new document and ready to receive the pasted info from the keychain.\n- You must have the iCloud Keychain unlocked and sorted in whatever order you want to copy/paste.\n- Update the \"password\" on line 73 to match yours.\n- Add/update the keystroke order in the script to add more/less fields to each copy/paste action. I chose to the first field, username, and password to export. You might want more/less fields.\n- You might have some instances where the delay's are not perfect, so pay attention to the output in TexEdit to make sure the data is coming across correctly.\n- Once you get it the way you like it an are confident, increase the repeat value on line 1 to something like 50. I would not recommend more than that.\n- Use at your own risk. If you know how to use AppleScript and Automator, then you might be just dangerous enough to screw things up. Good Luck!\n\n```applescript\nrepeat 1 times\n delay 0.2\n tell application \"Keychain Access\"\n     activate\n     \n     tell application \"System Events\"\n         delay 0.2\n         keystroke return\n         \n         -- Press ⌘C to copy item title\n         delay 0.2\n         keystroke \"c\" using command down\n     end tell\n end tell\n \n --Switch to TextEdit\n delay 0.2\n tell application \"TextEdit\"\n     activate\n     tell application \"System Events\"\n         -- Press ⌘V\n         delay 0.2\n         keystroke \"v\" using command down\n         \n         -- Type a comma\n         delay 0.2\n         keystroke \",\"\n         \n     end tell\n end tell\n \n --Switch to Keychain\n tell application \"Keychain Access\"\n     activate\n     tell application \"System Events\"\n         -- Press Tab x2 \n         delay 0.1\n         keystroke tab\n         delay 0.1\n         keystroke tab\n         \n         -- Press ⌘C\n         delay 0.2\n         keystroke \"c\" using command down\n     end tell\n end tell\n \n --Switch to TextEdit\n delay 0.2\n tell application \"TextEdit\"\n     activate\n     tell application \"System Events\"\n         -- Press ⌘V\n         delay 0.2\n         keystroke \"v\" using command down\n         \n         -- Type ','\n         delay 0.2\n         keystroke \",\"\n     end tell\n end tell\n \n --Switch to Keychain\n tell application \"Keychain Access\"\n     activate\n     tell application \"System Events\"\n         -- Click the “Show password:” checkbox.\n         delay 0.2\n         keystroke \"c\" using {shift down, command down}\n         \n         -- Type password - update to yours\n         delay 0.5\n         keystroke \"password\"\n         delay 0.2\n         keystroke return\n         \n         -- Close keychain item window\n         delay 0.3\n         keystroke \"w\" using command down\n         \n         -- Go to next keychain item\n         delay 0.2\n         key code 125\n     end tell\n end tell\n \n --Switch to TextEdit\n delay 0.2\n tell application \"TextEdit\"\n     activate\n     tell application \"System Events\"\n         -- Press ⌘V\n         delay 0.2\n         keystroke \"v\" using command down\n         \n         -- Press Return\n         delay 0.2\n         keystroke return\n     end tell\n end tell\nend repeat\nend run\n```\n\nSource: https://discussions.agilebits.com/discussion/comment/455708/#Comment_455708\n\n\n# Second version\n\nSteps:\n- Open Safari, go to Preferences and click on the Password tab.\n- Open TextEdit, go to Format menu and click \"Make Plain Text\".\n- Open Script Editor (Applications -\u003e Utilities -\u003e Script Editor). Start a new document and paste in the following script text.\n- Replace PASSWORD with your actual password for the Mac.\n- Look for the line that says \"repeat while (x ≤ 207)\" and replace the 207 with whatever you are comfortable with. If you have an iPhone or iPad running iOS 12, you can go to Settings -\u003e \"Passwords \u0026 Accounts\". To the right of \"Website \u0026 App Passwords\", you'll see the number you have saved in there. You can replace 207 with that number PLUS 1. So, if it says you have 10, type 11 instead.\n- Click the Play button in script editor and you should be off and running.\n- I've noticed that sometimes it won't put in the password because the field isn't highlighted. If that happens, stop the script, empty the TextEdit file and click on one of the other Preferences tabs and then click back on the Passwords tab and try running the script again.\n\nFor improve speed you can change dalays to 0.1 instead of last in `THIS FIRST REPEAT SECTION`\n\n```applescript\n-- OPEN SAFARI. GOTO PREFERENCES. CLICK PASSWORDS TAB --\n-- THIS FIRST REPEAT SECTION IS JUST TO GET TO THE PASSWORDS SCREEN AND LOGIN TO ICLOUD --\nrepeat 1 times\n    tell application \"Safari\"\n        activate\n        delay 0.5\n        tell application \"System Events\"\n            -- Ensure Password Field Selected --\n            keystroke tab\n            delay 0.2\n            -- Type your password for you --\n            keystroke \"PASSWORD\"\n            delay 0.2\n            -- Hit enter to login --\n            keystroke return\n            delay 0.2\n        end tell\n    end tell\nend repeat\n\n-- START GRABBING PASSWORDS - SET REPEAT VALUE TO NUMBER OF PASSWORDS --\nset x to 1\nrepeat while (x ≤ 207)\n    -- Switch To Safari --\n    tell application \"Safari\"\n        activate\n        delay 0.5\n        tell application \"System Events\"\n            -- Switch from search field to password list field (Only needs to be done once) --\n            if (x = 1) then\n                keystroke tab\n                delay 0.2\n            end if\n            -- Select first password in list (Field selected. but nothing highlighted) --\n            key code 125\n            delay 0.2\n            -- Open Right-click Menu -- \n            tell application process \"Safari\"\n                set _selection to value of attribute \"AXFocusedUIElement\"\n                tell _selection to perform action \"AXShowMenu\"\n            end tell\n            -- Down arrow once to choose/highlight \"Copy Website\" --\n            key code 125\n            delay 0.2\n            -- Copy Website/URL data --\n            keystroke return\n            delay 0.2\n        end tell\n    end tell\n    -- Switch To TextEdit\n    tell application \"TextEdit\"\n        activate\n        delay 0.5\n        tell application \"System Events\"\n            -- Print a double quote --\n            keystroke \"\\\"\"\n            delay 0.2\n            -- Paste \"Website/URL\" data to text file --\n            keystroke \"v\" using command down\n            delay 0.2\n            -- Print ending double quote and a comma for CSV --\n            keystroke \"\\\",\"\n            delay 0.2\n            -- Print a double quote --\n            keystroke \"\\\"\"\n            delay 0.2\n            -- Paste \"Websites\" data to text file again (For \"Title\" field in 1Password) --\n            keystroke \"v\" using command down\n            delay 0.2\n            -- Print ending double quote and a comma for CSV --\n            keystroke \"\\\",\"\n            delay 0.2\n        end tell\n    end tell\n    -- Switch To Safari --\n    tell application \"Safari\"\n        activate\n        delay 0.5\n        tell application \"System Events\"\n            -- Open Window containing \"User Name\", \"Password\" and \"Websites\" fields --\n            keystroke return\n            delay 0.2\n            -- Move to \"User Name\" field --\n            keystroke tab\n            delay 0.2\n            -- Copy data from \"User Name\" field --\n            keystroke \"c\" using command down\n            delay 0.2\n        end tell\n    end tell\n    -- Switch To TextEdit --\n    tell application \"TextEdit\"\n        activate\n        delay 0.5\n        tell application \"System Events\"\n            -- Print a double quote --\n            keystroke \"\\\"\"\n            delay 0.2\n            -- Paste \"User Name\" data to text file --\n            keystroke \"v\" using command down\n            delay 0.2\n            -- Print ending double quote and a comma for CSV --\n            keystroke \"\\\",\"\n            delay 0.2\n        end tell\n    end tell\n    -- Switch To Safari --\n    tell application \"Safari\"\n        activate\n        delay 0.5\n        tell application \"System Events\"\n            -- Move to \"Password\" field --\n            keystroke tab\n            delay 0.2\n            -- Copy from \"Password\" field --\n            keystroke \"c\" using command down\n            delay 0.2\n        end tell\n    end tell\n    -- Switch To TextEdit --\n    tell application \"TextEdit\"\n        activate\n        delay 0.5\n        tell application \"System Events\"\n            -- Print a double quote --\n            keystroke \"\\\"\"\n            delay 0.2\n            -- Paste \"Websites\" data to text file --\n            keystroke \"v\" using command down\n            delay 0.2\n            -- Print ending double quote and start a new line --\n            keystroke \"\\\"\"\n            keystroke return\n        end tell\n    end tell\n    -- Switch To Safari --\n    tell application \"Safari\"\n        activate\n        delay 0.5\n        tell application \"System Events\"\n            -- Click \"Done\" button --\n            keystroke return\n            delay 0.2\n        end tell\n    end tell\n    set x to (x + 1)\nend repeat\nend run\n```\n\nSource: https://discussions.agilebits.com/discussion/comment/465689/#Comment_465689\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoxblh%2Fkeychainexportpasswords","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoxblh%2Fkeychainexportpasswords","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoxblh%2Fkeychainexportpasswords/lists"}