Skip to content

Instantly share code, notes, and snippets.

@plu
Created February 18, 2021 07:32
Show Gist options
  • Save plu/938d467d3d4f56a846451b40e4f1e09e to your computer and use it in GitHub Desktop.
Save plu/938d467d3d4f56a846451b40e4f1e09e to your computer and use it in GitHub Desktop.
jenkins@macmini42 print_arch % pwd
/Users/jenkins/joplunien/print_arch
jenkins@macmini42 print_arch % cat Sources/print_arch/main.swift
#if arch(arm64)
print("arm64")
#elseif arch(x86_64)
print("x86_64")
#else
print("something else")
#endif
jenkins@macmini42 print_arch % ./print_arch
arm64
jenkins@macmini42 print_arch % file /Users/jenkins/joplunien/ruby-2.7.2/bin/ruby
/Users/jenkins/joplunien/ruby-2.7.2/bin/ruby: Mach-O 64-bit executable x86_64
jenkins@macmini42 print_arch % file print_arch
print_arch: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]
print_arch (for architecture x86_64): Mach-O 64-bit executable x86_64
print_arch (for architecture arm64): Mach-O 64-bit executable arm64
jenkins@macmini42 print_arch % ruby -e 'system "./print_arch"'
x86_64
jenkins@macmini42 print_arch % file /usr/bin/xcodebuild
/usr/bin/xcodebuild: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/xcodebuild (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/xcodebuild (for architecture arm64e): Mach-O 64-bit executable arm64e
jenkins@macmini42 print_arch % ruby -e 'system "arch -arm64 ./print_arch"'
arm64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment