中文 | English
OTPilot is a macOS 13+ menu bar utility for SMS one-time passwords. It watches the local Messages database, extracts likely verification codes, copies the code to the clipboard, and can optionally paste it into the currently focused field.
It is designed for browsers like Dia, Chrome, and Arc where macOS does not provide Safari-style SMS code autofill.
- Menu bar app, no Dock icon.
- Reads incoming SMS/iMessage rows from
~/Library/Messages/chat.db. - Extracts common English and Chinese OTP formats.
- Copies detected codes to the clipboard.
- Optional auto paste using Command-V.
- Optional clipboard restore after 45 seconds.
- Notification feedback when a code is copied and still needs to be pasted.
- Optional launch at login.
- Starts monitoring automatically when the app opens by default.
OTPilot is distributed as a downloadable DMG and as source code. The DMG is not notarized yet, so the first launch may require right-clicking the app and choosing Open, or approving it in System Settings.
- macOS 13 or later.
- Messages configured on the Mac and SMS forwarding/iMessage sync enabled.
- Full Disk Access permission for OTPilot.
- Accessibility permission if
Auto pasteis enabled. - For the DMG: Apple Silicon and Intel Macs are both supported; no Xcode or Command Line Tools are required.
- For source builds: macOS 13 SDK or later, plus Xcode or Apple Command Line Tools with
swift,make,codesign, and standard macOS developer tools available. - Optional for source builds: a local Apple Development signing identity. A free Apple ID development certificate is enough for local use; a paid Developer ID certificate is only needed for polished public distribution/notarization.
Check your local toolchain with:
swift --version
security find-identity -v -p codesigningThe recommended install path is the DMG. It contains a prebuilt app, so you do not need Xcode, Swift, or Terminal.
- Open the latest release.
- Download
OTPilot-v1.5.1.dmg. - Open the DMG.
- Drag
OTPilot.appto theApplicationsshortcut. - Open OTPilot from
/Applications.
Because this build is not notarized yet, macOS may block the first launch. If that happens, right-click OTPilot.app, choose Open, then confirm. On some macOS versions you may need to open System Settings -> Privacy & Security and click Open Anyway.
After the app opens, grant Full Disk Access. Grant Accessibility only if you want Auto paste.
If you prefer to build from source instead, download the source ZIP from the release, unzip it, and double-click Install OTPilot.command. That path requires Apple's Command Line Tools:
xcode-select --installmacOS will show an installation prompt. Follow the prompt, then double-click Install OTPilot.command again.
Run the install command from the project folder. For example, after cloning the repository:
git clone https://github.com/Cococolins/OTPilot.git
cd OTPilot
make installIf you downloaded the source as a ZIP, unzip it, open Terminal, cd into the unzipped OTPilot folder, then run:
make installThis builds the SwiftPM app, stages dist/OTPilot.app, signs it, copies it to /Applications/OTPilot.app, and launches the installed app.
You can also call the underlying script directly:
./script/build_and_run.sh --installUse --install during development too. macOS privacy permissions are tied to app identity and path, so switching between dist/OTPilot.app and /Applications/OTPilot.app can make Accessibility or Full Disk Access look enabled while the running app is not actually trusted.
OTPilot needs Full Disk Access to read:
~/Library/Messages/chat.db
Auto paste requires Accessibility permission. OTPilot uses the Accessibility API to check whether the currently focused UI element is an editable text field. If it is, OTPilot sends Command-V so browser paste handlers, including multi-box OTP fields, can still do their own splitting. If no editable field is focused, OTPilot leaves the code on the clipboard and shows a notification instead of blindly sending Command-V.
If auto paste does not work, check:
log show --last 5m --predicate 'subsystem == "app.otpilot.OTPilot"' --style compactExpected auto-paste logs look like:
Detected OTP ... autoPaste=true; accessibilityTrusted=true
Posted Command-V event
Posted Command-V event means the keyboard event was sent after OTPilot found a focused editable field. macOS still does not report whether the target app actually accepted the paste.
If the log says Accessibility is not trusted, remove any old OTPilot entry from System Settings, add /Applications/OTPilot.app again, and enable it.
Notifications intentionally do not include the OTP or sender. OTPilot shows a notification when it copies a code and cannot find a focused editable field. When it sends Command-V into a focused field, it does not show a notification because the paste action itself is the feedback.
The build script prefers a local Apple Development signing identity if one exists, and falls back to ad-hoc signing only when no identity is available.
Stable signing helps macOS keep Full Disk Access, Accessibility, and Login Items permissions across app updates.
Ad-hoc signed local builds can run, but macOS may treat frequent rebuilds as a changed app identity. If permissions appear to reset after every build, use a stable Apple Development certificate and keep installing to /Applications/OTPilot.app.
For public GitHub releases, a Developer ID signed and notarized build would provide the cleanest first-launch experience. Without notarization, users may need to right-click Open or approve the app in Privacy & Security the first time.
To override signing:
SIGN_IDENTITY="Apple Development: Your Name (TEAMID)" ./script/build_and_run.sh --installTo override the bundle identifier for your own builds:
BUNDLE_ID="com.example.OTPilot" ./script/build_and_run.sh --installThe parser is optimized for both English and Chinese SMS templates. It does not assume the code always appears after the keyword.
Supported examples include:
【豆瓣网】豆瓣登录验证码:2463
【哔哩哔哩】597700短信登录验证码
[瑞幸咖啡] 验证码:088864
Use 837201 as your login code.
G-789012 is your Google verification code
The current strategy is:
- Find verification keywords, including simplified/traditional Chinese variants.
- Enumerate 4-8 character candidates near the keyword.
- Filter likely date/time and URL tokens.
- Rank 6-digit numeric codes first, then 4-digit, other numeric, and alphanumeric codes.
Build only:
make buildBuild the app bundle:
make appBuild a distributable DMG:
make dmgThe DMG build creates a universal app by default, with both arm64 and x86_64 slices. To build a single-architecture DMG for local testing:
BUILD_ARCHS=arm64 make dmgInstall and launch:
make installVerify process launch:
make verifyStream app logs:
make telemetryInspect the running app path:
ps -axo pid,comm,args | rg 'OTPilot' | rg -v rgInspect code signature:
codesign -dv --verbose=4 /Applications/OTPilot.app 2>&1 | sed -n '1,90p'- OTeePee: macOS 15+ menu bar app that reads
~/Library/Messages/chat.db, detects OTP patterns, and copies codes to the clipboard. - imsg: robust Messages database reader and watcher. Useful for understanding
chat.db, filesystem events, and Full Disk Access behavior. - Faktor: browser-oriented OTP autofill system pairing a macOS app with a Chrome extension.
- XposedSmsCode, smscode-core, and smscode-rules: useful references for Chinese SMS-code parsing rules.
OTPilot is released under the MIT License.
OTPilot starts from the newest Messages row on first launch, so it does not scan old SMS history. Use Reset to clear the current detection state and reset the cursor to the latest message.
Auto paste is still focus-dependent: the target input field must be focused when the SMS arrives. OTPilot can now avoid sending Command-V when the focused UI element is clearly not editable, but it cannot choose the right field on a page by itself.