A guide that reached the top of Hacker News on 12 November 2026 shows how a Mac on Sequoia or Tahoe can keep an SSH key inside the Secure Enclave with Apple's own sc_auth and /usr/lib/ssh-keychain.dylib, so the private key never exists as a file. Create it with -k p-256-ne -t bio and every git push asks for Touch ID, including pushes a coding agent starts. Register a backup key first, because the key can never leave that Mac, and keep CI and App Store Connect keys on their own scoped credentials.
A short guide called "Protecting SSH Keys with macOS Secure Enclave" reached 387 points on Hacker News on 12 November 2026. The author, Serge Gatezh, first wrote it in February and updated it on 11 November. It shows how a Mac running Sequoia or Tahoe can create an SSH key inside the Secure Enclave, using only tools Apple ships, so the private key never exists as a file on disk.
That matters more to an iOS developer than to most people. The SSH key on your Mac usually pushes to the repo that holds your app, and often to the private repo where fastlane match keeps your encrypted signing certificates. Over the last few weeks the news has been full of developer machines and CI runners getting robbed: tampered editor extensions, hijacked GitHub accounts planting secret stealers in workflows, coding agents running commands nobody read. A plain ~/.ssh/id_ed25519 file is exactly the kind of thing that malware copies in one line. AI Agents Took 300+ iOS Signing Certificates From 10 Shops is one recent example of where that leads.
A Secure Enclave key changes two things. The private key can't be copied off the Mac at all, and if you create it with the biometric option, every single use asks for Touch ID. That second part is the interesting one in 2026: when a coding agent runs git push on your behalf, macOS stops and asks your finger first.
This post walks through the native setup, the Secretive app that the guide's author eventually switched to, how to wire either one into GitHub and Xcode work, and the trade-offs you need a plan for before you delete your old key.
What the Hacker News guide actually does
The native approach uses three pieces that are already on a current Mac:
sc_auth, Apple's smart card tool, which can create a CryptoTokenKit identity whose private key lives in the Secure Enclave./usr/lib/ssh-keychain.dylib, a security key provider library that lets OpenSSH talk to that identity as if it were a FIDO hardware key.- OpenSSH's own support for security keys, which shows up as the key type
sk-ecdsa-sha2-nistp256@openssh.com.
The method was first written up in a public gist by Arian van Putten, after people noticed that macOS Tahoe could generate and use these keys. Commenters later reported that it works on Sequoia too. Much of it was worked out by experiment. Nicolas Mattia, who wrote a similar guide in October, says plainly that the behaviour comes from reverse engineering and that he can't promise it stays the same in future macOS releases. Keep that in mind: this is a shipped Apple feature, but the SSH workflow on top of it is not something Apple documents step by step.
Step 1: See what keys you have today
Before you add anything, list what already has access. On your Mac:
ls -la ~/.ssh
ssh-add -l
cat ~/.ssh/config
Then open GitHub, go to Settings, then SSH and GPG keys, and compare. Most developers find at least one key they no longer recognise, often from an old laptop or a CI experiment. Write down which key each machine uses and which keys are also registered as signing keys. You will need this list when you retire the old file key at the end.
Also check whether something else is acting as your SSH agent. If ~/.ssh/config has an IdentityAgent line pointing at 1Password or another manager, the Gatezh guide notes that it can get in the way while you test the new key. Comment it out during setup and put it back later if you still need it.
Find out which of your current keys can be copied and used
The list from Step 1 tells you which keys exist. It does not tell you which ones are dangerous to lose. A private key file with no passphrase works for anyone who copies it, from a backup, a synced folder or a stolen laptop. This script lists each key pair in a folder, prints its type, size, fingerprint and comment, and says whether the private file opens without a passphrase. It only reads files:
#!/bin/bash
# keycheck.sh: list the SSH key pairs in a folder (default ~/.ssh) and say
# which private key files open without a passphrase. Reads files, changes nothing.
dir="${1:-$HOME/.ssh}"
for pub in "$dir"/*.pub; do
[ -e "$pub" ] || continue
key="${pub%.pub}"
info=$(ssh-keygen -lf "$pub")
if [ ! -f "$key" ]; then
state="public key only, no private file here"
elif ssh-keygen -y -P "" -f "$key" >/dev/null 2>&1; then
state="NO PASSPHRASE: anyone who copies this file can use it"
else
state="passphrase set"
fi
printf '%s\n %s\n %s\n' "$(basename "$key")" "$info" "$state"
done
It was run with the system bash on a Mac against a folder of sample keys made for this post, not against a real ~/.ssh: an Ed25519 key with a passphrase, an RSA key and an ECDSA key without one, and a public key whose private file was missing. With the fingerprints shortened, it printed:
ci_deploy
256 SHA256:... ci-experiment (ECDSA)
NO PASSPHRASE: anyone who copies this file can use it
github_actions
256 SHA256:... ci-experiment (ECDSA)
public key only, no private file here
id_ed25519
256 SHA256:... sample-with-passphrase (ED25519)
passphrase set
id_rsa
3072 SHA256:... old-laptop (RSA)
NO PASSPHRASE: anyone who copies this file can use it
Run it on your own Mac with no argument and it reads ~/.ssh. Two things to do with the output. Match each fingerprint against GitHub's SSH keys page, which shows the same SHA256 fingerprint for every key, and delete the keys nobody can explain. Then treat every "NO PASSPHRASE" key that can push to your app repo or your fastlane match repo as the first one to replace with the Secure Enclave key. The script was not tried on a Secure Enclave key handle, so read its line for id_ecdsa_sk_rk with the note from Step 3 in mind: that file is only a reference to the key.
Step 2: Create the key in the Secure Enclave
This is the command from the guide. It prompts for Touch ID once while it creates the identity:
sc_auth create-ctk-identity -l "ssh-MacBook" -k p-256-ne -t bio
The flags do the important work. -l is just a label, so pick one that tells you which Mac it is. -k p-256-ne asks for a NIST P-256 key that is non-exportable. Use exactly that type: commenters on the gist and Mattia both report that OpenSSH does not accept p-384-ne, and Secretive's FAQ states that the Secure Enclave only supports 256-bit elliptic curve keys, which is also why there is no RSA option.
-t bio requires Touch ID for every use of the key. Mattia's guide describes the alternative: with -t none the key still can't be extracted, but any program running as you can use it silently. For a key that can push to your app repo, the prompt is the whole point, so keep bio.
Check that the identity exists:
sc_auth list-ctk-identities
If creation fails with error -25293 and a message about a "bio catacomb UUID", Gatezh hit the same thing. His Touch ID enrolment had been reset, and re-enrolling a fingerprint in System Settings fixed it.
Step 3: Give OpenSSH a handle to the key
OpenSSH needs a small file that points at the Secure Enclave identity. Run this and press Enter when it asks for a PIN:
ssh-keygen -w /usr/lib/ssh-keychain.dylib -K -N ""
It writes id_ecdsa_sk_rk and id_ecdsa_sk_rk.pub into the current folder. Move both into ~/.ssh/. According to van Putten's gist, the private file is only a reference to the credential and holds no secret key material, so losing it is an inconvenience, not a leak. The PIN prompt is a side effect of OpenSSH expecting a FIDO device; Mattia explains that an empty PIN is fine here.
Next, tell SSH to use the Apple provider by default. Add this line to ~/.zshrc (or ~/.zprofile, as the gist suggests):
export SSH_SK_PROVIDER=/usr/lib/ssh-keychain.dylib
Open a new terminal so the variable is set. Gatezh found that the old habit of ssh-add -K with --apple-use-keychain does not work with these keys. The provider variable is what makes them usable.
Step 4: Point SSH at the new key for GitHub
SSH will not discover id_ecdsa_sk_rk on its own, which is why Gatezh kept getting asked for a password at first. Add an explicit entry. Scoping it to GitHub keeps the change contained while you test:
Host github.com
IdentityFile ~/.ssh/id_ecdsa_sk_rk
IdentitiesOnly yes
IdentitiesOnly yes is a standard OpenSSH option that stops SSH from also offering every other key it can find. Leave it out until the new key works if you want a fallback during testing, then add it so you know exactly which key is in use.
Copy the public key:
cat ~/.ssh/id_ecdsa_sk_rk.pub
The line starts with sk-ecdsa-sha2-nistp256@openssh.com and ends with a comment, by default ssh:. Gatezh corrected his own post on this: that trailing text is only a comment, so you can change it to something like your Mac's name to make it easy to spot later.
Add the key in GitHub under Settings, SSH and GPG keys, New SSH key, with type Authentication Key. GitHub has accepted security key types for Git over SSH since 2021, when its blog announced support for ecdsa-sk and ed25519-sk keys. Then test:
ssh -T git@github.com
Touch ID should appear before GitHub greets you by username. The prompt text is odd. It says something like "ctccardtoken needs to authenticate to continue" because the request comes from CryptoTokenKit, so you are not looking at a fake dialog. It is worth knowing what it looks like before you rely on it, so you can tell when something unexpected triggers it.
What a Tahoe Mac ships for this, checked from the terminal
The pieces this setup depends on were checked on a Mac running macOS 26.0.1 with these commands:
ls -l /usr/lib/ssh-keychain.dylib
ssh -V
ssh -Q key | grep sk-
ssh -G github.com | grep -E '^(identityfile|identitiesonly|securitykeyprovider) '
/usr/lib/ssh-keychain.dylibis there, 241,168 bytes, installed with the system.ssh -Vreports OpenSSH_10.0p2 with LibreSSL 3.3.6, andssh -Q keylistssk-ecdsa-sha2-nistp256@openssh.comandsk-ssh-ed25519@openssh.com. The only ECDSA security key type uses P-256, and there is no P-384 one, which fits the reports in Step 2 that a P-384 key does not work for SSH.- Running
sc_authwith no arguments prints its usage, andcreate-ctk-identityaccepts-k p-256|p-384|p-521|p-256-ne|p-384-neand-t bio|none. Sosc_authwill happily create ap-384-neidentity that OpenSSH then cannot use. Typep-256-neexactly. - With no config file,
ssh -G github.comlists the files SSH tries on its own:id_rsa,id_ecdsa,id_ecdsa_sk,id_ed25519,id_ed25519_skandid_xmss.id_ecdsa_sk_rkis not on that list, which is why Step 4 needs theIdentityFileline. - With the Host block from Step 4 in a config file,
ssh -Gshowedidentitiesonly yes, the singleidentityfile ~/.ssh/id_ecdsa_sk_rk, andsecuritykeyprovider $SSH_SK_PROVIDER. That last line is OpenSSH's default, and it is why exporting the variable in Step 3 is enough.
The same usage text also lists sc_auth delete-ctk-identity -h hash, which removes one identity if you created it with the wrong label or type, right next to delete-all-ctk-identities, which removes all of them. Copy the hash from sc_auth list-ctk-identities and use the single-identity command.
The key itself was not created for this post, because sc_auth create-ctk-identity needs a Touch ID press and leaves a new identity on the Mac. The Touch ID prompt and the GitHub test in Step 4 come from the sources, not from this check.
Step 5: Watch what happens when a coding agent pushes
This is where the setup pays off for anyone using Claude Code, Cursor, Codex or similar tools on an iOS repo. GitHub's own description of security keys explains the behaviour: remote operations such as push, fetch and pull need the key, local operations such as checkout, branch and merge do not, and clients do not cache taps across operations.
With a bio key, an agent can still edit files, run xcodebuild, make commits and switch branches without bothering you. The moment it tries to talk to GitHub, your Mac asks for Touch ID. If you didn't expect a push, don't touch the sensor. That turns a policy you hoped the agent would follow ("never push without asking") into something the hardware enforces.
Two practical things follow from this.
First, agent tasks that fetch often will prompt often. A long session that runs git pull in a loop will keep stopping. That is a reason to tell the agent when it may sync, not a reason to switch to -t none.
Second, an agent running inside a remote container or cloud sandbox can't reach your Secure Enclave at all. If you forward your local SSH agent to a remote host so it can push, you are lending your key to that machine for the length of the session. Keep forwarding off by default, and turn it on per host only when you mean to.
Step 6: Plan for a lost Mac before you need to
Every source agrees on the cost. The key is tied to one Mac's hardware and cannot be exported or backed up. Secretive's FAQ says a new computer means a new set of keys. The Hacker News discussion of Mattia's guide made the same point with a spilled coffee.
For GitHub this is easy to manage if you prepare:
- Register a second authentication key that does not live on this Mac. Gatezh suggests a YubiKey or a key from another Mac. Keep it somewhere safe.
- Make sure you can still sign in to GitHub without SSH, with your password and a second factor or a passkey, so you can add a new key from a browser.
- Write down which servers or services have the Secure Enclave key in
authorized_keys. Each one needs the backup key too.
Van Putten's gist also shows how to create an exportable identity with -k p-256 and export it to a file for backup. That gives up the main property you were after, since an exportable key can be copied. If you want a backup, a separate hardware key is the cleaner choice.
Step 7: Know what stays outside this setup
A Secure Enclave key protects one thing well: interactive SSH from your own Mac. Several parts of an iOS release pipeline sit outside it.
CI runners can't use it. GitHub Actions, Xcode Cloud or a Mac mini in a closet need their own credentials, usually a deploy key or a token scoped to one repo. Those stay files or secrets, so give them the narrowest access that works and rotate them on a schedule. Claude's "Sign Out Everywhere" Leaves Scheduled Tasks Running has an offboarding checklist for the other credentials an agent setup leaves behind.
App Store Connect API keys, the .p8 files that fastlane and other tools use to upload builds, are a different kind of credential and are not covered by anything here. The same goes for your distribution certificate's private key in the login keychain.
Commit signing is possible but test it before you trust it. GitHub supports signing commits with SSH keys in Git 2.34 or later, and commenters on the gist report pointing user.signingKey at the .pub file with SSH_SK_PROVIDER set. GitHub's documentation does not say whether it verifies signatures from security key types, so make one signed commit, push it, and check for the Verified badge before you switch your signing setup over.
git config --global gpg.format ssh
git config --global user.signingKey ~/.ssh/id_ecdsa_sk_rk.pub
git commit -S -m "Test signed commit"
Upload the same public key again in GitHub with type Signing Key for the badge to appear. If it does not show as verified, keep your current signing method.
The easier route: Secretive
Gatezh's verdict on the native approach was that it works but is ugly, and he moved to Secretive. It is an open-source Swift app by Max Goedjen that creates and stores SSH keys in the Secure Enclave, can require Touch ID or Apple Watch approval, and shows a notification each time a key is used. Dan Moren wrote about it for Six Colors in October and noted that on macOS Tahoe it also supports post-quantum MLDSA-65 and MLDSA-87 keys.
Install it with Homebrew or from the project's releases page:
brew install secretive
Its README says builds are produced by GitHub Actions and, from version 3.0, carry GitHub Artifact Attestations, so you can check that the app you downloaded came from that build process. Secretive works as an SSH agent and relies on the SSH_AUTH_SOCK environment variable; the app's setup screen and the project's separate config instructions repo explain how to point your shell and other apps at it. The FAQ also says each key's public key file location is shown as "Public Key Path" in the app, which you can reference from ~/.ssh/config to pick a specific key per host.
The trade-offs are the same as the native route. Keys can't be exported, and a new Mac needs a new setup. For a team, Secretive is easier to explain to a teammate than a page of sc_auth commands, and the per-use notification gives you a running record of what touched your key.
A 20-minute checklist for an iOS team
- List every SSH key on each developer Mac and in each GitHub account. Delete the ones nobody can explain.
- On each Mac, create a Secure Enclave key with Touch ID required, natively or with Secretive.
- Register it on GitHub as an authentication key and test with
ssh -T git@github.com. - Register a backup key that lives elsewhere, and confirm everyone can sign in to GitHub from a browser.
- Set
IdentitiesOnly yesfor github.com so the old file key is no longer offered. - After a week of normal work, remove the old public key from GitHub and delete the private file.
- Leave CI on scoped deploy keys or tokens, and review them separately.
- Tell everyone what the Touch ID prompt looks like, and that an unexpected one during an agent session means stop and look.
FAQ
Which macOS versions support Secure Enclave SSH keys?
The Gatezh guide says Sequoia and Tahoe. The original gist was written for Tahoe, and commenters reported it working on Sequoia. Secretive is a separate app; its README does not list a minimum version.
Does this work with GitHub?
Yes for authentication. GitHub supports security key types for Git over SSH, and the key appears as sk-ecdsa-sha2-nistp256@openssh.com. For commit signing, test with one signed commit first.
Can I use one key on two Macs?
No. A Secure Enclave key can't leave the Mac that created it. Create one key per Mac and register each one.
Why does SSH ask for a PIN?
OpenSSH treats the key like a FIDO device and asks out of habit. Press Enter with an empty PIN.
Do I have to run ssh-add after every reboot?
Mattia's guide loads the key into the agent and notes it must be reloaded after a restart. Gatezh's approach avoids the agent by setting SSH_SK_PROVIDER and an IdentityFile entry, so SSH uses the key directly.
Will this stop malware on my Mac?
It stops malware from copying the key file, because there isn't one. Code running as you could still try to use the key, which is why the Touch ID requirement matters. It does nothing for other secrets in your home folder, such as App Store Connect API keys or .env files.
If you use Claude Code on an iOS project, the Claude Code + Xcode: The Production iOS Workflow Kit is Jerry PM's set of CLAUDE.md and AGENTS.md templates, rules, commands and agents for SwiftUI and UIKit work, with a runnable sample project. Its rules include human approval gates around signing and destructive actions. It does not set up SSH keys, so pair it with the steps above.
Keep reading on JR Devhub
- Backdoored Claude Code Extension in Cursor: Check Your Mac, Then Rotate These iOS Keys
- A Ruby Gem Worm Writes CLAUDE.md and AGENTS.md Into Your Repos. What iOS Teams Using Fastlane Should Check
- Claude Code's "Don't Ask Again" Can Save Your Passwords. Find Them in Your iOS Repo and Clean Up
- Cloudflare's Security Audit Skill Went Viral. How to Run It on an iOS App Repo
Sources
- Serge Gatezh: Protecting SSH Keys with macOS Secure Enclave (Native Approach)
- Hacker News Daily Top 10, 12 November 2026
- Arian van Putten: Secure Enclave backed SSH keys on macOS (gist and comments)
- Nicolas Mattia: Setting Up SSH Keys on macOS with Touch ID
- GitHub Blog: Security keys are now supported for SSH Git operations
- GitHub Docs: About commit signature verification
- Secretive on GitHub (README and FAQ)
- Six Colors: Secretive helps you keep your SSH keys secret

Comments