Skip to content

Commit

Permalink
Detect Rosetta2 and fail if x86_64 is used on arm64
Browse files Browse the repository at this point in the history
Running `pod install` from inside Rosetta2 can lead to problems, try
to avoid doing that by hinting users from use_react_native!() function.

   $ arch -x86_64 pod install
   Building RNTester with Fabric enabled.
   Building RNTester with Fabric enabled.
   Building RNTester with Fabric enabled.
   Analyzing dependencies
   Downloading dependencies
   Generating Pods project
   Integrating client project
   Pod installation complete! There are 63 dependencies from the Podfile and 50 total pods installed.

   [!] Do not use Rosetta2 with "pod install"

   [!] Do not use Rosetta2 with "pod install"

   [!] Do not use Rosetta2 with "pod install"
  • Loading branch information
barbieri committed Sep 29, 2021
1 parent efa454b commit 8d49ab3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ def use_react_native! (options={})
# Include Hermes dependencies
hermes_enabled = options[:hermes_enabled] ||= false

# Running `pod install` from inside Rosetta2 is a bad sign
if `/usr/sbin/sysctl -n hw.optional.arm64 2>&1`.to_i == 1 && !RUBY_PLATFORM.start_with?('arm64')
Pod::UI.warn 'Do not use Rosetta2 with "pod install"'
end

# The Pods which should be included in all projects
pod 'FBLazyVector', :path => "#{prefix}/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "#{prefix}/React/FBReactNativeSpec"
Expand Down

0 comments on commit 8d49ab3

Please sign in to comment.