无法启动,或识别不到 GPUmacOS最后更新 2026年9月1日

"App is damaged and can't be opened" — Gatekeeper on macOS

macOS won't let me open LM Studio, Jan or a llama.cpp binary

作者 Jakub Rusinowski

错误信息

"LM Studio" is damaged and can't be opened. You should move it to the Bin.

"llama-cli" cannot be opened because the developer cannot be verified.

Apple could not verify "Jan" is free of malware that may harm your Mac or compromise your privacy.
你遇到的是哪一种?
如果你看到原因是前往
"cannot be opened because the developer cannot be verified"Signed but not notarised — the mildest caseFix 2: right-click → Open
"is damaged and can't be opened. You should move it to the Bin."Unsigned and quarantined; the wording is misleading, the file is usually intactFix 3: Open Anyway, then Fix 4 if that fails
A CLI binary from a release archive dies with "killed"Quarantine applied to the extracted fileFix 4: remove the attribute from that path only
A Python package fails on a bundled .dylibThe wheel's bundled library carries the quarantine attributeFix 4, scoped to the package directory
You cannot verify where the download came fromYou should not be bypassing Gatekeeper for it at allFix 1: verify first, or do not run it

何时出现

The word "damaged" is doing a lot of misleading work here. In almost every case the download is complete and intact — macOS is telling you it cannot establish who made it, and has chosen the most alarming phrasing available to say so.

  • You downloaded a release build of LM Studio, Jan, or another local-AI app from its website or GitHub.
  • You extracted a llama.cpp release archive and the binaries will not run.
  • A tool worked, then stopped after you re-downloaded a newer version.
  • A Python package installed cleanly and fails at import on a bundled dynamic library.
  • You moved an app between Macs with AirDrop or a USB drive.

实际原因

Anything a browser downloads gets an extended attribute, com.apple.quarantine, recording that it came from the internet. When you launch it, Gatekeeper checks that the code is signed by an identified developer and notarised — scanned and stamped by Apple. Most open-source AI tooling is neither: notarisation requires a paid developer account and a release step that small projects often skip. Gatekeeper cannot verify the code, and reports that as "damaged", which is misleading because the file is usually perfectly intact. The same attribute is why an extracted CLI binary is killed on launch and why a Python wheel's bundled .dylib can fail at import — quarantine applies to files, not just to .app bundles.

如何修复

  1. 1

    Verify the download before you bypass anything

    Do this first, every time. Download only from the project's official domain or its GitHub releases page. Compare the SHA-256 against the published checksum where the project publishes one. Check the signature with codesign — it tells you whether the binary is signed at all and by whom, and spctl tells you what Gatekeeper's own assessment is. An unsigned build from the project's own release page is a normal state of affairs; an unsigned build from a link someone posted is not.

    注意:Everything below removes or bypasses a macOS safety check. That is reasonable for a binary you have verified and reckless for one you have not. If you cannot establish where the file came from, the correct action is to delete it.
    zsh
    # zsh
    shasum -a 256 ~/Downloads/LMStudio.dmg
    
    # Is it signed, and by whom?
    codesign -dv --verbose=4 /Applications/LM\ Studio.app 2>&1 | head -12
    
    # What does Gatekeeper itself say?
    spctl --assess --type execute --verbose /Applications/LM\ Studio.app
    生效了吗?The hash matches the published checksum, and codesign names a signer you recognise — or the project is openly unsigned and you fetched it from its own release page.
  2. 2

    Right-click → Open — the narrowest fix that works

    For an app that is merely unverified rather than "damaged", right-click (or Control-click) the app in Finder and choose Open, then confirm in the dialog. This creates a one-off exception for that specific app and changes no system setting. Double-clicking will not offer the exception; the context menu is what does it. That difference is the whole trick and it is not discoverable.

    生效了吗?The app launches, and subsequent launches work normally by double-click.
    zsh
    spctl --assess --type execute --verbose /Applications/LM\ Studio.app
  3. 3

    Use "Open Anyway" in System Settings

    If the right-click route does not offer an Open option, try to launch it once so macOS records the block, then go to System Settings → Privacy & Security, scroll to the Security section, and click Open Anyway next to the message naming your app. The button appears only after a blocked attempt, which is why people who go looking for it first do not find it.

    生效了吗?The app opens and the entry disappears from Privacy & Security, having been resolved.
  4. 4

    Remove the quarantine attribute — only for a verified binary

    When the first two do not work — commonly for CLI binaries and .dylib files rather than .app bundles — remove the attribute directly. Scope it as tightly as you can: name the single file where you can, and the specific app or package directory otherwise. Check first with xattr -l that quarantine is actually the attribute present, so you know this is the right tool.

    注意:xattr -dr com.apple.quarantine strips the OS safety check from everything under the path you give it. Never run it against your Downloads folder, your home directory, or /Applications as a whole — only against the one app or file you have verified.
    zsh
    # zsh — what attributes does the file actually carry?
    xattr -l /Applications/Jan.app
    
    # Remove quarantine from ONE verified app
    xattr -dr com.apple.quarantine /Applications/Jan.app
    
    # A single CLI binary from a release archive
    xattr -d com.apple.quarantine ./llama-cli
    生效了吗?xattr -l no longer lists com.apple.quarantine for that path, and the binary runs.
    zsh
    xattr -l /Applications/Jan.app; ./llama-cli --version
  5. 5

    Prefer Homebrew casks, which sidestep most of this最常见的修复方法

    Installing through brew install --cask avoids the majority of these prompts, because Homebrew fetches the file itself rather than a browser and handles quarantine as part of the install. It also gives you a maintained upgrade path, which matters for fast-moving projects where you would otherwise re-download and re-bypass every few weeks. This is the better default for anything Homebrew packages.

    zsh
    # zsh
    brew install --cask lm-studio
    brew install ollama
    
    # Keep them current without repeating the whole dance
    brew upgrade --cask
    生效了吗?The app launches directly from /Applications with no Gatekeeper prompt.
    zsh
    brew list --cask | grep -i studio
    检查哪些模型适配你的硬件pick a model sized for your Mac once the app opens打开显存检查器 →
  6. 6

    Handle the Python and dylib case

    A Python package can install cleanly and then fail at import because a bundled .dylib inside the wheel is quarantined — the error mentions the library rather than anything about security, so the connection is not obvious. Find the quarantined files under the package directory and clear those specific ones. If a package repeatedly needs this, prefer a wheel built for your architecture from the project's own index, which usually does not.

    zsh
    # zsh — find quarantined libraries inside a virtualenv
    find .venv -name "*.dylib" -exec xattr -l {} ; -print 2>/dev/null | grep -B1 quarantine
    
    # Clear them for that package only
    xattr -dr com.apple.quarantine .venv/lib/python3.12/site-packages/<package>
    生效了吗?The import succeeds and xattr -l on the library reports no quarantine attribute.
    zsh
    python3 -c "import <package>; print('ok')"

如果以上都没用

If the app opens and then fails for a different reason, the next questions are whether your Mac meets its requirements at all — several tools now require Apple Silicon — and whether the model you are loading fits your memory.

上报问题时请附上这些信息
  • The exact wording of the dialog, including the app name in quotes
  • Output of codesign -dv --verbose=4 and spctl --assess --verbose on the app
  • Output of xattr -l on the file
  • Your macOS version, and where you downloaded the file from

相关内容

常见问题

Is my download actually damaged?

Almost never. macOS says "damaged" when Gatekeeper cannot verify the code signature or notarisation of a quarantined file. The bytes are usually intact — the app is simply unsigned, which most small open-source projects are.

Why does right-clicking and choosing Open work when double-clicking does not?

Because the context-menu Open path offers a one-time exception for that specific app, while a double-click just enforces the block. It changes no system setting and is the narrowest of the fixes, which is why it is the one to try first.

Is xattr -dr com.apple.quarantine safe?

It is safe for a binary you have verified and dangerous as a habit, because it strips the OS check from everything under the path you give it. Scope it to a single app or file. Never run it against Downloads, your home directory, or all of /Applications.

Why does a Python package hit this?

Because quarantine applies to files, not only to .app bundles. A wheel containing a bundled .dylib downloaded through a browser carries the attribute, and the import fails with an error about the library rather than about security, which hides the cause.

Is there a way to avoid this entirely?

Largely, yes: install through Homebrew where the project is packaged. Homebrew fetches the file itself rather than a browser and handles quarantine during installation, and it gives you an upgrade path so you are not repeating the bypass on every release.