Symptom: Your Xcode Cloud build succeeds, but a file created by a custom script is missing from the downloadable build artifacts.
Fastest fix: Treat script-created files as temporary. Upload anything you need to keep to external storage, or produce it in a build environment whose file handling you control, then verify the file can actually be retrieved.
This guide is for independent developers who cannot find a script-generated file in a build or its downloads; small teams that need to retain reports, resources, or release attachments; and developers deciding whether Xcode Cloud fits their artifact handoff requirements.
Xcode Cloud custom script artifacts missing: identify the delivery boundary
A successful build does not mean every file created during the workflow becomes a downloadable artifact. Apple’s custom build script documentation states that files created by custom scripts are deleted and are not included in downloadable build artifacts. Start by separating the build result from files your script writes.
That distinction resolves many apparent “missing artifact” incidents:
- The build result is what the workflow produces and reports through Xcode Cloud.
- A custom-script file is something your script creates during its execution, such as a generated resource, a report, or an attachment.
- An externally retained file is one your workflow deliberately sends to storage outside the temporary script workspace.
A reliable diagnosis starts with the file’s origin. Ask whether Xcode Cloud’s workflow action created the item, whether a custom script wrote it, or whether another system received it. Then check the matching location: workflow results for system-generated outputs, script logs for temporary files, and the chosen destination for uploaded files.
Temporary files between custom script phases
Xcode Cloud supports custom scripts at workflow stages such as post-clone, pre-xcodebuild, and post-xcodebuild. Apple describes these stages and their purpose in its custom build script guidance. The stage tells you when a script runs; it does not turn a file created by that script into a persistent workflow artifact.
Where does Xcode Cloud save files created by a custom script?
Do not assume there is a durable Xcode Cloud folder where custom-script files are saved for later download. Apple documents that these files are cleaned up and excluded from downloadable build artifacts. If the next script phase or a later workflow needs the file, design an explicit handoff rather than relying on a shared temporary file.
This matters when a script generates something early in the workflow and another script expects to read it later. If the handoff depends on a file left in the first script’s workspace, that assumption conflicts with the documented cleanup behavior. Keep the file within the work of the script that needs it, regenerate it in the later phase, or deliberately transfer it to a destination you control.
Use the phase as a diagnostic clue:
- After checkout: Check whether the needed source file is actually present in the repository version used by the workflow. A file on your local machine is not proof that the remote checkout contains it.
- Before the Xcode build: Confirm that generation happens before the build action that consumes the file. Check the script log for the output path and for a successful write.
- After the Xcode build: Confirm that the script sees the expected build output before it attempts to package, report, or upload anything.
Can ci_post_xcodebuild.sh upload build artifacts?
It can run post-build logic, but that does not mean Xcode Cloud automatically promotes files it creates into downloadable build artifacts. If your ci_post_xcodebuild.sh script needs to deliver a report or attachment, it must use an external destination your project has configured and is authorized to access. The exact upload command and destination depend on your existing storage setup.
Treat upload as a separate workflow responsibility. Confirm that the script can read the file, has the necessary credentials, sends the file to the intended destination, and logs a result that you can verify. A message saying “upload started” is weaker evidence than checking the destination and retrieving the uploaded object.
Before relying on the upload, review the Xcode Cloud environment variable reference and the workflow reference for custom environment variables. Use the documented environment values that apply to your workflow, and keep credentials out of source files and diagnostic output. If a command prints environment variables wholesale, its log may expose secrets; log only the non-sensitive path or status information you need to diagnose the transfer.
Reports missing from a successful build
What if a report is missing even though the Xcode Cloud build succeeded?
First identify whether the missing report is a workflow result or a file generated separately by your script. A test result produced by a configured test action is not the same thing as a JSON, HTML, or text report that a custom script writes. Check the workflow actions and the relevant build or test results before concluding that Xcode Cloud lost an artifact.
Apple’s guide to configuring a first Xcode Cloud workflow explains the workflow setup and the role of build artifacts. Compare your workflow’s configured actions with the item you expect to see. If the report should come from a test action, inspect the workflow’s test results. If your script creates an auxiliary report, inspect the script log and verify whether the file was written at all.
Use this sequence to isolate the failure:
- Find the workflow action that is supposed to produce the report.
- Check whether that action ran and completed, rather than relying only on the overall build status.
- For a script-generated report, confirm the command ran and record the file path without printing the report’s sensitive contents.
- Check whether the report was sent to an external destination. If not, its absence from the downloadable build artifacts is consistent with Apple’s documented boundary.
- Retrieve the file from its intended destination and open it. A successful build or upload log alone does not prove the file is readable or complete.
Local files and remote workflow differences
A file that exists locally but not in the remote build may never have reached the workflow environment. Check whether it is tracked in the source control revision used by the build, whether the script can run, and whether its paths match the remote checkout.
Apple’s custom-script guidance describes the expected script placement and execution requirements. Verify that your script is in the documented ci_scripts location, has a valid shebang, and is executable in the repository. Then inspect the build log for the script’s start marker and for the expected file path. A script that exists on your workstation but is missing from the checkout cannot generate its output remotely.
Dependencies can create a similar false lead. A local tool or package may exist on your Mac but not be available in the cloud workflow. Review Apple’s guidance on making dependencies available to Xcode Cloud, then confirm the remote environment can access the tools your script invokes.
Keep the investigation focused on three points: generation, delivery, and retrieval. If the file is absent immediately after the generation command, investigate the script and its inputs. If it exists in the script’s output but is not in the downloadable artifacts, check the documented retention boundary. If it was uploaded but cannot be found, verify the destination, object path, permissions, and retrieval method in your own storage system.
To make this repeatable, add concise diagnostic output around the file operation. Log the working directory, whether the expected path exists, and the upload result. Avoid dumping environment variables, signing material, or report contents into the build log. Once the workflow completes, retrieve the file through the same route your team will use; that is the acceptance test, not simply seeing a successful build status.
Retention choices and fit ratings
The right choice depends on who needs the file and how long it must remain available. These ratings describe fit for the stated requirement, not a claim about build speed or service performance.
| Option | Download from Xcode Cloud | Long-term retention | Best fit | Fit rating |
|---|---|---|---|---|
| Leave the file in a custom script workspace | No; custom-script files are cleaned up and excluded from downloadable build artifacts | No | Temporary work used within the script that creates it | Weak |
| Use a workflow-generated build or test result | Check the configured action and its result view | Only to the extent provided by the workflow’s documented result handling | Build and test outputs produced by the workflow itself | Strong when the output matches |
| Upload the file to your configured external storage | Not as an Xcode Cloud artifact; retrieve it from the external destination | Defined by your storage and retention policy | Reports or attachments that teammates need later | Strong when retrieval is verified |
| Produce and inspect the file in a controlled Mac build environment | Depends on the environment and delivery design you configure | Depends on your own storage and cleanup rules | Workflows that require interactive inspection or custom filesystem control | Conditional |
A repeatable artifact verification runbook
Use this sequence when the next build is available. It separates a generation fault from an Xcode Cloud artifact expectation and from an external delivery fault.
- Name the required file and its owner. Record whether it should come from a workflow action or a custom script, who needs it, and where that person expects to retrieve it.
- Confirm the workflow revision. Check that the script and its inputs are part of the source revision used by the build. If the file is generated from a dependency, confirm the remote workflow can access that dependency.
- Verify script discovery and execution. Check the documented script location, shebang, executable permission, and the build log. If the script did not run, fix that before investigating artifact downloads.
- Log generation evidence. After the command that creates the file, log a safe existence check and the path. Keep file contents and secrets out of the log.
- Choose a valid delivery route. For a workflow-produced result, inspect the corresponding action and result. For a custom-script file that must persist, send it to external storage or use a build environment with a delivery path you control.
- Verify credentials and destination. Confirm the script can access the intended destination, while avoiding commands that expose credentials in logs. Use the environment-variable documentation to check which workflow values are available.
- Retrieve and open the delivered file. Have the intended consumer use the real retrieval path. Check that the file is present and usable, not merely that a command returned success.
- Record the boundary for the team. Document which files are workflow results, which are temporary, and which are stored externally. This prevents a later successful build from being mistaken for proof that every auxiliary file was retained.
Choosing Xcode Cloud or a Mac build environment
Choose based on the required artifact handoff, not on a generic claim that one build model is always better. Xcode Cloud fits when its workflow results meet your needs and your scripts can explicitly deliver any additional files. A controlled Mac environment is worth evaluating when your process depends on retaining files for inspection, controlling the filesystem, or changing how the job hands outputs to the team.
| Requirement | Xcode Cloud with explicit external delivery | Controlled Mac build environment | Decision |
|---|---|---|---|
| Download a workflow-generated build result | Use the configured workflow action and its supported result path | Configure the build and delivery path yourself | Keep Xcode Cloud if the result meets the requirement |
| Retain a file created by a custom script | Upload it to storage configured by your project | Design and verify your own retention and retrieval path | Either can work; test the actual handoff |
| Inspect intermediate files interactively | Do not assume custom-script workspace files persist | More suitable when the environment provides the access and control you need | Consider a Mac environment if inspection is essential |
| Avoid maintaining a persistent Mac workflow | Keep the workflow in Xcode Cloud and externalize retained files | Requires you to manage the environment and its delivery process | Prefer the simpler route that passes your acceptance test |
For a temporary evaluation or a build workflow that needs an interactive Mac environment, you can review MACGPU’s remote Mac options. A remote Mac can give you a place to inspect and manage the build process, but you still need to define where outputs live and how teammates retrieve them. If you also need to assess remote access and SSH-based control before testing the build itself, this remote Mac SSH tunnel and API guide covers access patterns separately from artifact retention. For long-running, stable workloads or jobs that require physical interfaces, assess whether renting fits before switching; owning suitable hardware or keeping your current build service may be the better choice.
The key decision is to stop treating a successful Xcode Cloud build as proof that custom-script files were retained. Confirm the file’s origin, use the supported workflow result when it applies, and explicitly upload anything else you need to keep. If Xcode Cloud’s file boundary conflicts with your inspection or handoff requirements, compare that workflow with a controlled Mac environment and verify retrieval before migrating.