Skip to content

Instantly share code, notes, and snippets.

@funroll
Created June 22, 2014 04:23
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save funroll/7faf18b4972d72cd284e to your computer and use it in GitHub Desktop.
Save funroll/7faf18b4972d72cd284e to your computer and use it in GitHub Desktop.
CocoaPods post_install step for changing Build Active Architecture Only from Yes to No.
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |configuration|
target.build_settings(configuration.name)['ONLY_ACTIVE_ARCH'] = 'NO'
end
end
end
@funroll
Copy link
Author

funroll commented Jun 22, 2014

I also found this post_install step helpful.

post_install do |installer_representation|
  installer_representation.project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ARCHS'] = 'armv7 armv7s'
    end
  end
end

@dbrisinda
Copy link

This is an improved version that combines the above two versions and works for Xcode 5.1.1. Based on the (updated) original by Cameron Spickert.

# Remove 64-bit build architecture from all pod targets and override 'Build Active Architecture Only' to NO.
post_install do |installer|
  installer.project.targets.each do |target|
    target.build_configurations.each do |configuration|
      target.build_settings(configuration.name)['VALID_ARCHS'] = '$(ARCHS_STANDARD_32_BIT)'
      target.build_settings(configuration.name)['ONLY_ACTIVE_ARCH'] = 'NO'
    end
  end
end

@funroll
Copy link
Author

funroll commented Jul 9, 2014

@dbrisinda Thanks for that version--handy to have both in one!

@nickjbauer
Copy link

Updated for more recent: cocoapods 0.39.0 (unsure what other versions it supports).

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |configuration|
target.build_settings(configuration.name)['ONLY_ACTIVE_ARCH'] = 'NO'
end
end
end

@peterjenkins
Copy link

@nickjbauer Thanks for the update, that works with CocoaPods 1.0 as well.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |configuration|
      target.build_settings(configuration.name)['ONLY_ACTIVE_ARCH'] = 'NO'
    end
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment