Sub topic 14
Importing and exporting with CSV files
The Passwords app can move logins in and out of your Mac as a CSV file. This is how you bring in logins from another password manager or a browser, and how you take a copy out. This chapter covers both directions, the file format, how to check a file before importing it, and how to handle the exported file safely.
This chapter assumes you have macOS Sequoia 15 or later, you are signed in with your Apple Account, and you can already add and edit entries in the Passwords app. It also assumes you can open a text file in an editor.
What a CSV file is
A CSV file (comma-separated values) is a plain text table. Each line is one row, and commas separate the columns. The first line holds the column names. The Passwords app uses these columns:
| Column | Holds |
|---|---|
| Title | The name shown in the entry list |
| URL | The website address the login belongs to |
| Username | The account name or email address |
| Password | The password, in plain text |
| Notes | Free text attached to the entry |
| OTPAuth | An optional setup link for a verification code |
Here is a minimal file with one entry:
Title,URL,Username,Password,Notes,OTPAuth
Example Site,https://example.com,[email protected],replace-with-real-password,,The two commas at the end of the row leave Notes and OTPAuth empty. The row still needs all six fields, so the commas must stay.
The overall flow
Both directions follow the same pattern. The file exists only for the short time it takes to move the data, and you delete it afterward.
Importing passwords
Start in the other app. Find its export option, usually under a settings, file or tools menu, and choose CSV as the format. Save the file somewhere you can find it, such as your Desktop.
Then, in the Passwords app on your Mac:
- Choose File > Import Passwords.
- Click Choose File and select the CSV.
- Click Import and wait for the confirmation.
- Look through the imported entries to confirm they appear.
- Delete the CSV file.
Imported entries become part of your normal list. If iCloud Keychain syncing is on, they also sync to your other Apple devices, as described in the chapter on syncing.
Check the file before importing
Different apps write slightly different headers. If a header does not match what the Passwords app expects, a column can be ignored or an entry can come in with a missing field. It is cheaper to find this before importing than to clean up afterward.
The script below reads a CSV and reports the header names, the row count, and any rows missing a URL, username or password. It never prints a password.
import csv
import sys
EXPECTED = ["Title", "URL", "Username", "Password", "Notes", "OTPAuth"]
def check(path):
with open(path, newline="", encoding="utf-8-sig") as f:
reader = csv.DictReader(f)
header = reader.fieldnames or []
print("Header:", header)
missing = [name for name in EXPECTED if name not in header]
if missing:
print("Missing columns:", ", ".join(missing))
rows = 0
for number, row in enumerate(reader, start=2):
rows += 1
for field in ("URL", "Username", "Password"):
if not (row.get(field) or "").strip():
print(f"Line {number}: empty {field}")
print("Rows:", rows)
if __name__ == "__main__":
if len(sys.argv) != 2:
sys.exit("Usage: python check_csv.py file.csv")
check(sys.argv[1])Run it with python3 check_csv.py ~/Desktop/logins.csv. The utf-8-sig encoding handles the invisible byte-order mark that some apps put at the start of a file. That mark otherwise attaches itself to the first header name and makes Title look like a different column.
Common import problems
- Renamed or reordered columns. Another app may call the first column
NameorLogininstead ofTitle. Open the file in a plain text editor such as TextEdit in plain text mode and rename the header to match. - Commas inside values. A password or note that contains a comma must be wrapped in double quotes, for example
"pass,word". A spreadsheet or exporting app normally does this for you. Hand-edited files are where it goes wrong. - Spreadsheet damage. Opening the file in a spreadsheet and saving it can change text. It may drop leading zeros or turn some values into dates. Edit in a text editor when you can.
- Rows with no URL. An entry without a website address can be saved, but Safari cannot offer it on any site. Add the right URL before importing if you want it to fill.
- Duplicates. If you import a file whose logins are already in the app, check afterward for doubled entries. Search for the site name and delete the extra copy. The chapter on finding, editing and deleting entries covers this.
Exporting passwords
Export is the reverse. Use it to move to another manager or to keep a copy for a specific purpose.
- In the Passwords app, choose File > Export All Passwords.
- Confirm in the dialog.
- Authenticate with Touch ID or your Mac password.
- Choose a location and save the file.
The authentication step is the same protection described in the chapter on unlocking and auto-lock. It exists because the result is the most sensitive file your Mac can produce.
Two limits matter. The CSV format has no place for passkeys, so a passkey stays in the Passwords app and does not travel in the file. Also check the exported entries against the other app after import, because each app maps the columns in its own way. Verification code setup links travel in the OTPAuth column, so confirm those codes still work in the new app before you remove them from the Passwords app.
Handling the exported file safely
The risk is the file itself, so the rules are about where it sits and how long it stays.
- Save it to a folder that is not synced. A file in iCloud Drive, Dropbox or a similar service is copied to other computers and servers.
- Do not email it, post it in chat, or attach it to a ticket.
- Delete it right after the import is finished and verified. Then empty the Trash, because a file moved to the Trash is still on disk.
- Turn on FileVault in System Settings > Privacy & Security. With FileVault on, the disk is encrypted, so a deleted file is not readable by someone who gets at the raw storage.
- Check for other copies. Look in Downloads, the Desktop and any backup folder the other app may have written to.
On a Mac with an SSD, overwriting a file before deleting it does not reliably erase it, so do not rely on "secure delete" tools. FileVault is the protection that holds up.
Verifying the result
After an import, spot-check instead of assuming it worked.
- Compare the number of entries to the row count the script reported. A difference means some rows were skipped or merged.
- Open two or three entries and confirm the username, URL and password are filled in.
- Visit one imported site in Safari and confirm AutoFill offers the login.
- If you imported verification code links, confirm a code is generated for one of those entries.
If an entry fails, edit it in the app. Rerunning the whole import is the worse fix, because it creates duplicates.
Exercise
You export your logins to move to another manager and the import there succeeds. List what you do next with the CSV file, and name one place you should not have saved it.
Show answer
Verify a few logins and a verification code in the new app, then delete the CSV and empty the Trash. Do not save it in a synced folder such as iCloud Drive, because the plain-text file would be copied to other devices and servers. Also check Downloads and the Desktop for stray copies, and rely on FileVault so the deleted data cannot be read from the disk.
Exercise
Your CSV has the header Name,Website,Login,Pass. What will you change before importing it into the Passwords app, and which tool should you use?
Show answer
Rename the header to Title,URL,Username,Password,Notes,OTPAuth, adding empty Notes and OTPAuth fields to each row if they are missing. Use a plain text editor, not a spreadsheet, so the values are not reformatted. Then run a check such as the script above before importing.