ipatool failed

In my Xcode Version 16.0, I try to export an adhoc IPA file (sure the certificate is correct). get error ipatool failed, error in log 

2024-10-27 07:56:28 +0000  Output: ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin24]
/Applications/Xcode.app/Contents/SharedFrameworks/AppThinning.framework/Resources/ipatool:4135: warning: assigned but unused variable - prev
/Library/Ruby/Gems/2.6.0/gems/CFPropertyList-3.0.6/lib/cfpropertylist/rbCFPropertyList.rb:83: warning: assigned but unused variable - temp
Ignoring date-3.3.4 because its extensions are not built. Try: gem pristine date --version 3.3.4
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:117:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/date-3.3.4/lib/date_core.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/date-3.3.4/lib/date_core.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Ruby/Gems/2.6.0/gems/date-3.3.4/lib/date_core.bundle' (no such file), '/Library/Ruby/Gems/2.6.0/gems/date-3.3.4/lib/date_core.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')) - /Library/Ruby/Gems/2.6.0/gems/date-3.3.4/lib/date_core.bundle (LoadError)
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:117:in `require'
	from /Library/Ruby/Gems/2.6.0/gems/date-3.3.4/lib/date.rb:4:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:117:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:117:in `require'
	from /Library/Ruby/Gems/2.6.0/gems/CFPropertyList-3.0.6/lib/cfpropertylist/rbCFPropertyList.rb:4:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:65:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:65:in `require'
	from /Library/Ruby/Gems/2.6.0/gems/CFPropertyList-3.0.6/lib/cfpropertylist.rb:3:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
	from /Applications/Xcode.app/Contents/SharedFrameworks/AppThinning.framework/Resources/ipatool:15:in `<main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- cfpropertylist (LoadError)
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Applications/Xcode.app/Contents/SharedFrameworks/AppThinning.framework/Resources/ipatool:15:in `<main>'
2024-10-27 07:56:28 +0000  JSON: error: Error Domain=NSCocoaErrorDomain Code=260 "The file “ipatool.json” couldn’t be opened because there is no such file." UserInfo={NSUnderlyingError=0x60001d36e790 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}, NSURL=file:///var/folders/dy/b75q3b0500zf9jw82qtzh4xc0000gn/T/IPATool.ytsiVVI/ipatool.json, NSFilePath=/var/folders/dy/b75q3b0500zf9jw82qtzh4xc0000gn/T/IPATool.ytsiVVI/ipatool.json}

My Ruby version in mac(in terminal)

- ruby -v
ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [arm64-darwin24]
- which ruby
/Users/ayaaboud/.rvm/rubies/ruby-3.3.5/bin/ruby

I try to make xcode project lock to my ruby version instead of ruby in system by make executable code but error still exists while export ipa file.

I try to make xcode project lock to my ruby version instead of ruby in system

Your modified Ruby environment here is the source of the problem.

dlopen(/Library/Ruby/Gems/2.6.0/gems/date-3.3.4/lib/date_core.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/date-3.3.4/lib/date_core.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

This error cites the date Ruby gem of version 3.3.4, but a clean macOS 15 system comes with version 2.0.3 installed, as reported by gem query --local on a fresh macOS 15 installation. Further, there is no date folder in /Library/Ruby/Gems/2.6.0/gems on a clean system, but your system has one, and it has a binary for Intel that can't be used on an Apple silicon Mac in this context.

You will need to revert your Ruby configuration back to the default one macOS provides, or modify it in a way that isolates what you need for other work you do from the system environment so that Xcode's internal components do not fail in this way.

— Ed Ford,  DTS Engineer

ipatool failed
 
 
Q