Crea un’app iOS senza Mac, con Codex su un Mac a noleggio
Puoi creare una vera app per iPhone senza avere un Mac. Noleggia un Mac e lascia a Codex il lavoro sul Mac. Codex è l’agente di programmazione di OpenAI. Prima di iniziare legge un file chiamato AGENTS.md. Ne abbiamo scritto uno che spiega a Codex come un Mac crea le app iOS, passo per passo. Abbiamo testato i suoi primi tre passi su uno dei nostri Mac il 14 novembre 2026. Questa pagina spiega ogni passo e ti dà il file completo.
Perché ti serve ancora un Mac
Codex può scrivere Swift su qualsiasi computer. Ma solo un Mac può compilare un’app iOS. Xcode, il simulatore e gli strumenti di firma di Apple girano solo su macOS. Senza di loro, Codex scrive codice che non può mai eseguire né vedere. Con loro, può compilare l’app, aprirla nel simulatore, fare uno screenshot e controllare il proprio lavoro. La nostra pagina su perché un agente di programmazione iOS ha bisogno di un Mac approfondisce il tema.
Cosa ti serve
- Un Mac raggiungibile dal tuo computer. Un Mac di MacRun è un Mac mini M6 dedicato nella nostra struttura privata nel New Jersey. Ha già Xcode 27.1 e Homebrew. Con il piano agenti c’è anche Codex.
- Un account ChatGPT. Codex accede con questo account. Valgono i limiti di utilizzo del tuo piano.
- Un account Apple Developer, più avanti. Ti serve solo per mettere l’app sul tuo iPhone o sull’App Store. Costa 99 USD all’anno. I passi con il simulatore non richiedono alcun account.
- Nessuna esperienza con Xcode. Il file chiede a Codex di spiegare ogni passo con parole semplici e di mostrarti uno screenshot.
Cosa fa AGENTS.md
AGENTS.md è un semplice file di testo con delle istruzioni. Codex lo legge prima di ogni attività. Un file in ~/.codex/AGENTS.md vale per tutti i tuoi progetti. Un file dentro la cartella di un progetto vale per quel progetto.
Il nostro file dice a Codex quattro cose:
- Cosa è installato sul Mac, e come verificarlo.
- Le regole. Ogni app nel suo repo git. Mai chiavi o password in git. Mai chiedere la password del tuo Apple ID. Controllare il lavoro prima di dire che funziona.
- I comandi esatti per creare, compilare, avviare e testare un’app.
- Come caricare una build di test su TestFlight con la tua chiave API.
Passo 0: metti il file al suo posto
Apri il Terminale sul Mac, oppure collegati via SSH. Scarica il file nella cartella di Codex, poi avvia Codex. Se Codex non è installato, installalo prima con Homebrew.
mkdir -p ~/.codex curl -fsSL https://macrun.dev/blueprint/AGENTS.md -o ~/.codex/AGENTS.md brew install --cask codex # only if codex is missing codex
La prima volta, scegli Sign in with ChatGPT. Il login apre un browser sul Mac. Puoi completarlo dalla scrivania del Mac, nel tuo browser.
Passo 1: descrivi l’app e lascia che Codex la crei
Un file di progetto Xcode è difficile da scrivere a mano, per le persone e per gli agenti. Per questo il file chiede a Codex di usare XcodeGen. Codex scrive un breve project.yml, e XcodeGen lo trasforma in un vero progetto Xcode. Codex installa XcodeGen con Homebrew quando gli serve.
Poi di’ a Codex cosa vuoi, con parole tue. Per esempio:
Make a new iPhone app called Tally. It has one big button that counts taps and remembers the count. Use SwiftUI. Follow AGENTS.md and show me a screenshot when it runs.
Codex ti chiederà il tuo dominio inverso, come com.tuonome. Diventa l’inizio del bundle ID dell’app.
Passo 2: compila, avvia e fai uno screenshot
Questo è il ciclo che rende utile un agente su iOS. Codex compila l’app, avvia il simulatore, installa l’app e fa uno screenshot. Poi guarda l’immagine. Se il layout è rotto, se ne accorge e lo sistema prima di te.
SIM="iPhone 17" xcodebuild -scheme Tally -destination "platform=iOS Simulator,name=$SIM" \ -derivedDataPath build build xcrun simctl bootstatus "$SIM" -b xcrun simctl install "$SIM" build/Build/Products/Debug-iphonesimulator/Tally.app xcrun simctl launch "$SIM" com.yourname.tally sleep 3; xcrun simctl io "$SIM" screenshot /tmp/shot.png
Non devi digitarli tu. Codex li esegue per te. Sono qui perché tu sappia cosa sta facendo.
Passo 3: esegui i test
Il progetto ha un target di test fin dall’inizio. Chiedi a Codex di aggiungere un test per ogni funzione. Li esegue tutti con un solo comando:
xcodebuild test -scheme Tally \ -destination "platform=iOS Simulator,name=iPhone 17" -derivedDataPath build
Cosa è successo quando l’abbiamo testato
Il 14 novembre 2026 abbiamo eseguito i passi da 1 a 3 su uno dei nostri Mac M6. Abbiamo usato XcodeGen 2.46, Xcode 27.1 e il simulatore di iPhone 17. Il progetto è stato generato, l’app si è compilata e avviata, lo screenshot è arrivato e i test sono passati. Poi abbiamo scritto i passi così come hanno funzionato. Così è nato questo file.
Passo 4: mettila sul tuo iPhone con TestFlight
Un Mac remoto non vede un iPhone vicino a te. Non puoi collegarci il telefono. TestFlight è il modo per portare l’app sul tuo telefono. Per questo passo ti serve l’Apple Developer Program.
- Crea l’app in App Store Connect, con lo stesso bundle ID.
- Crea una chiave API di App Store Connect con il ruolo App Manager. Scarica il file .p8 una sola volta e mettilo sul Mac in ~/.appstoreconnect/private_keys/.
- Dai a Codex il key ID, l’issuer ID e il tuo Team ID.
- Chiedi a Codex di caricare una build di test. Archivia l’app e la carica con xcodebuild e la tua chiave.
- Installa la build dall’app TestFlight sul tuo iPhone.
Codex non ha mai bisogno della password del tuo Apple ID. La chiave si occupa della firma e del caricamento. Per chiarezza: non abbiamo ancora eseguito questo passo dall’inizio alla fine sulla nostra flotta, perché serve un account sviluppatore. Segue il flusso xcodebuild documentato da Apple per i caricamenti con chiave API. La nostra guida alla pubblicazione tratta App Store Connect più in dettaglio.
Passo 5: automatizza, se vuoi
- Carica a ogni push. Un runner di GitHub Actions può girare sullo stesso Mac. Leggi la nostra guida al runner self-hosted.
- Esegui un’attività a orari fissi. Un LaunchAgent può avviare
codex execcon un’attività a un’ora stabilita e registrare il risultato. Il file chiede a Codex di mostrarti come disattivarlo.
Il file AGENTS.md completo
Copialo da qui, oppure scarica AGENTS.md. È scritto per un Mac di MacRun. Su un altro Mac, cambia le prime righe in base a ciò che è installato lì.
# This Mac: how to build iOS apps here
You are a coding agent on a dedicated MacRun Mac mini (M6, macOS 27). The person you work with
may be new to iOS. Explain what you do in plain words, one step at a time, and show them the
result (a simulator screenshot) after each change they can see.
## What is installed
- Xcode 27.1 with iOS 27.1, 27.0 and 26.5 simulators. Check with `xcrun simctl list devices available`.
- Homebrew (`/opt/homebrew/bin`), git, Node, Ruby, fastlane, Codex and Claude Code.
- Not installed until needed: XcodeGen. Install it with `brew install xcodegen`.
## Rules
- Keep projects in `~/Projects/<AppName>`. Make each one a git repo and commit after each working step.
- Never put secrets in git: no `.p8` keys, passwords or API tokens. Keep App Store Connect keys in
`~/.appstoreconnect/private_keys/` and add `*.p8` to `.gitignore`.
- Never ask the person for their Apple ID password. Signing and uploads use an App Store Connect API key.
- The Mac does not sleep. Do not change power, sharing or network settings.
- Check the work yourself: build, run tests, and look at a screenshot before you say it works.
## 1. Create a new app
Xcode projects are hard to write by hand, so describe the project in `project.yml` and let XcodeGen
make the `.xcodeproj`:
```yaml
name: Hello
options:
bundleIdPrefix: com.example # ask the person for their own reverse domain
deploymentTarget: { iOS: "26.0" }
targets:
Hello:
type: application
platform: iOS
sources: [Sources]
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: com.example.hello
MARKETING_VERSION: "1.0"
CURRENT_PROJECT_VERSION: "1"
GENERATE_INFOPLIST_FILE: YES
INFOPLIST_KEY_UILaunchScreen_Generation: YES
INFOPLIST_KEY_UISupportedInterfaceOrientations: UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight
TARGETED_DEVICE_FAMILY: "1" # iPhone only; use "1,2" for iPad too
HelloTests:
type: bundle.unit-test
platform: iOS
sources: [Tests]
dependencies: [{ target: Hello }]
settings:
base:
GENERATE_INFOPLIST_FILE: YES
schemes:
Hello:
build: { targets: { Hello: all } }
test: { targets: [HelloTests] }
```
Write SwiftUI code in `Sources/` (an `App` struct and a `ContentView`), tests in `Tests/`, then run
`xcodegen generate`. Run it again whenever you add or remove files.
## 2. Build and run in the simulator
```sh
SIM="iPhone 17"
xcodebuild -scheme Hello -destination "platform=iOS Simulator,name=$SIM" \
-derivedDataPath build build
xcrun simctl bootstatus "$SIM" -b # boots it and waits until ready
xcrun simctl install "$SIM" build/Build/Products/Debug-iphonesimulator/Hello.app
xcrun simctl launch "$SIM" com.example.hello
sleep 3; xcrun simctl io "$SIM" screenshot /tmp/shot.png
```
Open `/tmp/shot.png` to check the screen, and show it to the person. They can also open the
Mac's desktop in Screen Sharing or the browser to look for themselves.
## 3. Run the tests
```sh
xcodebuild test -scheme Hello -destination "platform=iOS Simulator,name=iPhone 17" -derivedDataPath build
```
## 4. Test builds and uploads to TestFlight
This needs the person's paid Apple Developer account. Do these steps with them:
1. They create the app in App Store Connect (Apps, +, New App) with the same bundle ID.
2. They create an API key in App Store Connect (Users and Access, Integrations, App Store Connect API,
role App Manager). They download the `.p8` file once and put it in `~/.appstoreconnect/private_keys/`.
You need three values: the key ID, the issuer ID, and their Team ID (Membership page).
3. Set the Team ID in `project.yml` (`DEVELOPMENT_TEAM`, with `CODE_SIGN_STYLE: Automatic`) and regenerate.
Then each upload is:
```sh
KEY_ID=...; ISSUER=...; KEY=~/.appstoreconnect/private_keys/AuthKey_$KEY_ID.p8
AUTH="-allowProvisioningUpdates -authenticationKeyPath $KEY -authenticationKeyID $KEY_ID -authenticationKeyIssuerID $ISSUER"
xcodebuild -scheme Hello -configuration Release -destination "generic/platform=iOS" \
-archivePath build/Hello.xcarchive archive $AUTH
xcodebuild -exportArchive -archivePath build/Hello.xcarchive \
-exportOptionsPlist ExportOptions.plist -exportPath build/export $AUTH
```
`ExportOptions.plist`:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<key>method</key><string>app-store-connect</string>
<key>destination</key><string>upload</string>
<key>teamID</key><string>TEAM_ID_HERE</string>
</dict></plist>
```
Raise `CURRENT_PROJECT_VERSION` before every upload; App Store Connect rejects a repeated build number.
The build shows in TestFlight after Apple processes it, which can take a while. If the person
prefers fastlane, `fastlane pilot` does the same with the same API key.
## 5. Automate it
- To upload on every push, a GitHub Actions self-hosted runner can run on this Mac. Ask first.
- To run a task on a schedule, use a LaunchAgent in `~/Library/LaunchAgents` that calls
`codex exec "<task>"`, and log to a file. Show the person how to turn it off.
## Limits
- No physical iPhone can be plugged in. Use the simulator here and TestFlight on their own phone.
- Apple's review is done by Apple. You can prepare the build, but the person submits for review.
Consigli per lavorare a un’app con Codex
- Chiedi una piccola modifica alla volta. Guarda lo screenshot dopo ognuna.
- Lascia che Codex faccia un commit dopo ogni passo riuscito. Così una modifica sbagliata è facile da annullare.
- Fai il push del repo su GitHub, così il tuo codice vive anche fuori dal Mac.
- Non incollare mai chiavi o password nella chat. Metti tu il file .p8 sul Mac.
- Quando qualcosa non va, di’ cosa vedi. Codex può fare un altro screenshot.
Cosa non fa
- Non può testare su un telefono collegato al Mac. Usa il simulatore e TestFlight.
- Apple esamina ogni app dell’App Store. L’app la invii tu per la revisione.
- Codex può sbagliare. Sei tu a decidere cosa pubblicare.
- Noi forniamo il Mac e il file. Non sviluppiamo la tua app.
Quanto costa
Un Mac per agenti di MacRun costa $169 al mese, con Xcode 27.1 e Codex installati. Non va mai in stop, quindi Codex può continuare a lavorare mentre il tuo computer è spento. Codex è incluso nel tuo piano ChatGPT. L’Apple Developer Program costa 99 USD all’anno, e serve solo per TestFlight e l’App Store.
Chi non dovrebbe noleggiare un Mac per questo
Se hai già un Mac, usalo. Lo stesso file funziona anche lì. Se vuoi un’app senza scrivere codice, un builder no-code potrebbe fare più al caso tuo. Per altre strade, leggi sviluppare app iOS senza Mac.
Domande frequenti
Posso creare un’app iOS senza Mac usando un agente AI?
+
L’agente può scrivere il codice ovunque, ma compilare ed eseguire un’app iOS richiede Xcode, che gira solo su macOS. Noleggia un Mac, avvia Codex su di esso, e l’agente può compilare, avviare il simulatore e controllare il proprio lavoro.
Che cos’è AGENTS.md?
+
Un semplice file di testo con istruzioni che Codex legge prima di ogni attività. Un file in ~/.codex/AGENTS.md vale per tutti i progetti. Un file nella cartella di un progetto vale per quel progetto. Il nostro spiega a Codex come creare, compilare, testare e caricare un’app iOS su un Mac.
Avete testato questo AGENTS.md?
+
Abbiamo testato i passi da 1 a 3 su uno dei nostri Mac M6 il 14 novembre 2026. Abbiamo usato XcodeGen 2.46, Xcode 27.1 e il simulatore di iPhone 17. Il passo TestFlight non è ancora stato eseguito dall’inizio alla fine. Segue il flusso xcodebuild documentato da Apple per i caricamenti con una chiave API di App Store Connect.
Mi serve un account Apple Developer?
+
Non per compilare e avviare l’app nel simulatore. Ti serve l’Apple Developer Program, 99 USD all’anno, per TestFlight sul tuo iPhone. Ti serve anche per pubblicare sull’App Store.
Posso testare l’app sul mio iPhone?
+
Sì, tramite TestFlight. Codex archivia e carica una build di test, e tu la installi dall’app TestFlight. Non puoi collegare il tuo iPhone a un Mac remoto.
Codex ha bisogno della password del mio Apple ID?
+
No. Il file dice a Codex di non chiederla mai. La firma e i caricamenti usano una chiave API di App Store Connect, che crei tu e metti tu sul Mac.