Your SSH key probably lives at ~/.ssh/id_ed25519, protected by file permissions and not much else. If a malicious script runs on your Mac (the classic "clone this repo for the technical interview"), it copies the key and can get into your servers from anywhere. On November 11, developer Serge Gatezh published a tutorial that reached more than 300 points on Hacker News: how to create the key inside your Mac's Secure Enclave, using tools macOS already ships with, no third-party apps. The private key never leaves the chip, and every use can ask for Touch ID. Here's the procedure, its stumbling blocks, and the cost nobody mentions in the first line.
Honest disclaimer: I didn't test it. This comes from Gatezh's tutorial, Apple's documentation, and notes from other developers who documented it earlier.
What the Secure Enclave is and why it matters
According to Apple, the Secure Enclave is a subsystem isolated from the main processor, designed to protect sensitive data "even when the application processor kernel is compromised." It's in every Mac with Apple silicon and in Intel Macs with the T2 chip. The developer documentation sets two limits: it only works with NIST P-256 keys, and it can't import existing keys, only create them.
In practice: the key isn't left on disk, only a reference that's useless on any other machine. When you connect, the Mac asks the enclave to sign the server's challenge.

The procedure, step by step
1. Create the identity in the enclave. macOS ships with sc_auth, the CryptoTokenKit smart card tool:
sc_auth create-ctk-identity -l "ssh-MacBook" -k p-256-ne -t bio
sc_auth list-ctk-identities
-k p-256-ne means P-256 non-exportable; -t bio requires Touch ID on every use. If it blows up with a -25293 error, Gatezh fixed it by re-enrolling his fingerprint in Settings.
2. Extract the reference for SSH. The bridge is /usr/lib/ssh-keychain.dylib, which exposes the identity as if it were a FIDO key:
ssh-keygen -w /usr/lib/ssh-keychain.dylib -K -N ""
mv id_ecdsa_sk_rk* ~/.ssh/
If it asks for a PIN, just hit Enter: it isn't used with biometric keys.
3. Tell SSH which provider to use. In your ~/.zshrc:
export SSH_SK_PROVIDER=/usr/lib/ssh-keychain.dylib
Heads up: a lot of old guides say ssh-add -K. That flag is deprecated and, according to Gatezh, not even its replacements work here because they're for the Keychain, not for CryptoTokenKit.
4. Upload the public key to the server as usual (ssh-copy-id -i ~/.ssh/id_ecdsa_sk_rk.pub usuario@servidor). It will be of type sk-ecdsa-sha2-nistp256@openssh.com.
5. Make SSH find it. SSH doesn't automatically look for files named id_ecdsa_sk_rk; Gatezh had to declare it in ~/.ssh/config:
Host *
IdentityFile ~/.ssh/id_ecdsa_sk_rk
If you use the 1Password agent, it may clash with this.
The catches
- There's no backup. The key dies with the Mac, by design. Gatezh's way out: register two keys on every server, the enclave one and another from a YubiKey or a different Mac.
- It's barely documented. The person who found the trick described it in July 2024 on the OpenSSH mailing list as "pretty... weird," and the gist that popularized it came from experimentation, not an Apple manual.
- Homebrew's OpenSSH doesn't respect the
SSH_SK_PROVIDERvariable; according to that same thread, there you have to pass-o SecurityKeyProvider=/usr/lib/ssh-keychain.dylib. - The Touch ID prompt is ugly: it says "ctkcardtoken" needs to authenticate, not that SSH wants your key. That's why Gatezh updated his post to say he switched to Secretive, an open source app that stores keys in that same Secure Enclave, with a better interface and notifications every time a key is used.
My take
For anyone who manages servers from a Mac, this is about the cheapest thing you can do for your security: three commands and a fingerprint. It doesn't protect you from everything; if someone controls your Mac, they can try to trick you into approving a signature. But it does eliminate the most common and dumbest scenario: someone copies a file and walks off with your keys forever. The sensible setup is the enclave key for everyday use and a physical key stored away as a backup. And if the "ctkcardtoken" prompt makes you uneasy, Secretive does the same thing with a nicer face.
Sources
- Protecting SSH Keys with macOS Secure Enclave (Native Approach), Serge Gatezh
- Protecting keys with the Secure Enclave, Apple Developer
- The Secure Enclave, Apple Platform Security
- Native Secure Enclave backed ssh keys on MacOS, gist by Arian van Putten
- Apple's SSH x OpenSSH x CTK x Security Key types, openssh-unix-dev mailing list
- Secretive on GitHub
- Hacker News discussion