@smbcloud / cli / commits / 0b170f0

Fix gem with native component on macos 27 beta

keypair34 committed Jun 21, 2026 at 14:20 UTC 0b170f07201b9b166e89b03027bfc496a102fea2
1 file changed +18
sdk/gems/auth/Rakefile
+18
@@ -11,4 +11,22 @@ RbSys::ExtensionTask.new('auth', GEMSPEC) do |ext|
11 ext.lib_dir = 'lib/auth'
12 end
13
14 +# macOS: the rb_sys/rake-compiler build emits the bundle as an MH_DYLIB with an
15 +# empty LC_ID_DYLIB install name (a plain `cargo build` does not). dyld on macOS
16 +# 15+/Tahoe rejects that with "load command string extends beyond end of load
17 +# command", so the gem fails to load. Stamp a valid install name onto every
18 +# bundle the build produces by enhancing the bundle file tasks themselves (which
19 +# is what `rake native gem` runs, not the top-level `compile`). install_name_tool
20 +# re-signs ad-hoc, ships on the macOS gem-build runners, and works across archs
21 +# (cross-built x86_64 bundles too). Idempotent.
22 +if RbConfig::CONFIG['host_os'] =~ /darwin/
23 + Rake::Task.tasks.each do |t|
24 + next unless t.name.end_with?('auth.bundle')
25 +
26 + t.enhance do
27 + sh 'install_name_tool', '-id', '@rpath/auth.bundle', t.name if File.exist?(t.name)
28 + end
29 + end
30 +end
31 +
32 task default: :compile