I read https://helgesver.re/articles/macos-vulgar-word-flags about ~/Library/Keyboard/VulgarWordUsage.db, the per-app, per-recipient SQLite store macOS autocorrect uses to learn which swear words I am willing to type. The file does not exist on my Mac and I want to understand why and make macOS create it, without faking it: the OS must write the file, not you.
What is already known, so you do not have to rediscover it:
- AppleSpell (the autocorrect XPC service at /System/Library/Services/AppleSpell.service) hosts the iOS keyboard engine for inline predictive text. The database is created by TextInputCore's TI::VulgarWordUsageDatabaseWrapper the moment AppleSpell lazily initializes a TIKeyboardInputManager for a language. That happens once per AppleSpell process per language, and only when a real text view asks for inline predictions. Calling NSSpellChecker from a command-line tool does not reach that path.
- The usual reason the file is missing is that ~/Library/Keyboard itself does not exist. SQLite creates missing files but never a missing parent directory, so the open fails with ENOENT and AppleSpell carries on with a NULL handle. The failure is visible in the unified log as a com.apple.libsqlite3 error naming the path.
Do this, reading before concluding at every step:
- Confirm the state on this machine: whether ~/Library/Keyboard and the .db exist, and whether the unified log holds a failed open of that path by AppleSpell. Use /usr/bin/log explicitly (log is a zsh builtin). A log query over 30 days can take minutes; run it in the background rather than shrinking the window.
- Confirm the code is present on this macOS version by searching the dyld shared cache under /System/Volumes/Preboot/Cryptexes/OS/System/Library/dyld/ for the string VulgarWordUsage, and the Lexicon private framework's exports for LXVulgarWordUsageDatabaseCreate. If it is absent, stop and report that instead of continuing.
- If the folder is missing, create ~/Library/Keyboard, then restart AppleSpell with kill -9 on its pid (it is relaunched on demand; a plain kill is ignored).
- Start a background log stream for AppleSpell filtered to the com.apple.TextInput, com.apple.libsqlite3 and com.apple.Lexicon subsystems. Then drive real keystrokes into a new, unsaved TextEdit document with osascript and System Events, a sentence or two containing common profanity, and close that document without saving. Stop the stream afterwards.
- Read the result: list ~/Library/Keyboard, dump the schema and all rows of VulgarWordUsage.db and AutocorrectionRejections.db with sqlite3 -readonly, and quote the TIKeyboardInputManager initialization line from the stream.
Done means either the .db exists with a properties table holding version 2 and you have shown the log line proving AppleSpell created it, or you have shown exactly which step failed and what the log said. Do not create the database yourself with sqlite3 or by calling the Lexicon API; the point is to observe the OS do it. Expect vword_usage to be empty afterwards: rows are only written when autocorrect proposes replacing a vulgar word and the user keeps the original, which rarely happens for correctly spelled words.
You may create the folder, restart AppleSpell, run TextEdit through System Events and write scratch files in a fresh mktemp -d directory without asking. Do not change System Settings, do not touch any other file under ~/Library, and do not delete anything except files you created. only if a step would need something other than that.
Report in plain prose: what existed before, what the log showed, what you did, what exists now with the schema and row counts, and the one-line reason the file was missing on this Mac.