xcodebuild command does not generate a Product

180 Views Asked by At

I am on mac Sonoma 14.1.1, using xcode v.15.0

I am trying to build a bundle with xcode through a bash script, with a command that looks something like this:

sudo xcodebuild build -project $(dirname "$PWD")/MyProject.xcodeproj -scheme "INTEL_Generic" -derivedDataPath "derData/" -configuration Release HOME=${HOME}

Sudo is used to allow writing privileges, and the HOME definition is because the bash script environment kept passing /var/root/ as home instead of /Users/me.

but while some logging info gets created inside of the defined /derData correctly, the build/Products folder that should contain my .bundle appears missing.

This is what the derived data folder contains

Derived data folder

I tried building from inside the xcode application using product->build, which generated the product well enough, but even though the command line declares the building a success, no product or intermediates gets generated. This is the output

Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild build -project /Users/me/Documents/MyProject.xcodeproj -scheme INTEL_Generic -derivedDataPath derData/ -configuration Release HOME=/Users/me

User defaults from command line:
    IDEDerivedDataPathOverride = /Users/me/Documents/derData
    IDEPackageSupportUseBuiltinSCM = YES

Build settings from command line:
    HOME = /Users/me

--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:x86_64, id:13BCBEA6-9D69-52BE-9F0C-C03D51DA1439 }
{ platform:macOS, name:Any Mac }
ComputeTargetDependencyGraph
note: Building targets in dependency order
note: Target dependency graph (1 target)
    Target 'INTEL_Project' in project 'Project' (no dependencies)

GatherProvisioningInputs

CreateBuildDescription

ClangStatCache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang-stat-cache /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk /Users/me/Documents/derData/SDKStatCaches.noindex/macosx14.0-23A334-4a76ee93ef69e462914ffe9883de22b8.sdkstatcache
    cd /Users/me/Documents/MyProject.xcodeproj
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang-stat-cache /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -o /Users/me/derData/SDKStatCaches.noindex/macosx14.0-23A334-4a76ee93ef69e462914ffe9883de22b8.sdkstatcache

** BUILD SUCCEEDED **

1

There are 1 best solutions below

0
asevko On

Try adding CONTENTS_FOLDER_PATH to your xcodebuild invocation.

So your command will look line this:

OUTPUT_DIR= # your output directory

sudo xcodebuild build \
    -project $(dirname "$PWD")/MyProject.xcodeproj \
    -scheme "INTEL_Generic" \
    -derivedDataPath "derData/" \
    -configuration Release \
    HOME=${HOME} \
    CONTENTS_FOLDER_PATH="$OUTPUT_DIR/MyBundle.bundle"