Rsync Error When Building Unity Project with Xcodebuild

Hi everyone,
Not sure if this is the right place to ask this but I’m encountering an issue with building my Unity project using xcodebuild. Specifically, I’m getting an rsync error that is preventing the build from completing successfully. What’s strange is that I can build the project without any issues using the Xcode GUI. I am trying to create a iOS build on my M2 Mac Mini using unity 2020.3.35f1.

I am able to export my xcode project via terminal using this:

/Applications/Unity/Hub/Editor/2020.3.35f1/Unity.app/Contents/MacOS/Unity -batchmode -quit -projectPath "${PWD}" -executeMethod BuildEditorWindow.BuildPlayer_iOS_Development -logFile "Build/UnityBuildlog_iOS.txt" -username'[username]' -password'[password]'

Then i create an archive using this:

xcodebuild -workspace "${IOS_PROJ}/Unity-iPhone.xcworkspace" -scheme Unity-iPhone -derivedDataPath build -allowProvisioningUpdates -configuration Release -archivePath "Build/ios/${PRODUCT_NAME}.xcarchive" archive

and the error i am getting is this:

rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/FirebaseCore.framework" "/Users/arnav/Documents/Dev/Equestriad/Build/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/InstallationBuildProductsLocation/Applications/Equestriad.app/Frameworks"

sending incremental file list

rsync: [sender] change_dir "/Users/arnav/Documents/Dev/Equestriad/Build/ios/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos" failed: No such file or directory (2)

sent 19 bytes received 12 bytes 62.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1356)[sender=3.2.7]
Command PhaseScriptExecution failed with a nonzero exit code

Unsure if this is even the exact error message but i couldn’t find anything else resembling an error message. I’ve tried googling the error message, but the results seem to be all over the place and not very helpful. Has anyone else encountered this error when building a Unity project with xcodebuild? If so, do you have any suggestions on how to resolve it?

Thanks in advance for your help!

Found the solution for this here