You already restarted Xcode and chose Clean Build Folder. Archive in the Product menu is still gray. Claude Code finished the Swift files and the project, and ⌘B compiles. The button stays gray because the run destination is still a simulator, or this scheme has no Archive action. Signing errors show up only after the button turns on.
Set the run destination to Any iOS Device
The destination under the toolbar is probably an iPhone simulator. Archive is offered only for a generic device destination. Apple's distribution guide treats Archive as the step that produces a build for release, and that step does not target a simulator.
- Click the run destination at the top of the Xcode window.
- Choose Any iOS Device (arm64). A physical iPhone is optional. Do not pick a simulator.
- Open the Product menu again. If Archive is no longer gray, this step is done.
A gray button is a destination or scheme problem. Certificates join in only after Archive actually runs.
Confirm Archive is checked and the scheme is shared
Use Product → Scheme → Manage Schemes. The current scheme needs both of these: Archive is checked under Edit, and Shared is checked in the list on the left.
A scheme Claude Code created on one Mac may land in xcuserdata. That folder usually stays out of Git. Copy the project to the Mac that exports the build and the App scheme is missing, so the Product menu has nothing to archive. After you check Shared, the file appears under xcshareddata/xcschemes. Commit that file and pull it on the packaging Mac.
If the list has only a test target or a Swift package, and no iOS App target, Archive stays gray. Point the scheme's Archive action at the .app target.
Check the same thing from the command line
Once the button enables, you can archive with the same destination the menu uses. Write a generic iOS device destination, not a simulator name.
xcodebuild -scheme YourApp -showdestinations xcodebuild archive \ -scheme YourApp \ -configuration Release \ -destination 'generic/platform=iOS' \ -archivePath build/YourApp.xcarchive
If -showdestinations cannot see this scheme, the shared scheme was not committed. “scheme not found” and a gray menu item are the same problem.
If it is still gray, match the symptom
| What you see | Change this first |
|---|---|
| The destination says iPhone 16 Simulator | Switch to Any iOS Device (arm64) |
| Manage Schemes has no App name | On the Mac that still has the full project, check Shared and commit |
| The scheme's Archive row is empty | Point Archive at the App target, not the test target |
| The button is clickable and export then fails signing | Stop changing the destination. Inspect the keychain on the packaging Mac |
For a single package, aligning the destination and the scheme is enough. If you ship every week, keep the shared scheme in the repo so you do not rebuild it on every machine.
Shortest path
- Set the run destination to Any iOS Device (arm64).
- In Manage Schemes, point Archive at the App and check Shared.
- Commit
xcshareddata/xcschemesand pull on the packaging Mac. - Choose Product → Archive. Deal with signing only after the button is clickable.
Next step
Compile and sign on the same Mac that has Xcode. If the button works and export still fails, finish the handoff in this article:
Claude Code on Windows for iOS: which Mac runs the build and signing
Sources
- Archive and distribution: Distributing your app for beta testing and releases
- Destinations and schemes: Customizing the build schemes for a project
FAQ
Why is Archive gray when a simulator is selected?
Archive is available only for a generic iOS device destination. If the run destination is a simulator or My Mac, Archive stays gray in the Product menu. Switch to Any iOS Device (arm64) and look again.
Does a signing mismatch gray out the Archive button?
Usually no. Certificate and profile errors appear after the button is clickable and Archive has started. If the button itself is gray, check the destination and the scheme before reinstalling certificates.
Why can't another Mac see a scheme Claude Code just created?
A scheme that lives only under xcuserdata is not in Git. In Manage Schemes, check Shared so the file is written to xcshareddata/xcschemes, then commit it.
The button works but export fails. Which article is next?
Read which Mac runs the build and the signing. Archive has to run on the Mac that has Xcode and the private key in its keychain.