Skip to content
Browse files

Make the default target for `platform :osx` the current system's version

This change makes the default target when the platform is `:osx` the
system's version of OS X if it can be found by querying the
system. Otherwise the default '10.6' is used. Setting the target in
the podfile still overrides the default target.
  • Loading branch information...
1 parent fe96a97 commit dec9d1ce408f7cc28c62ffa1acd2a702e33bcc33 @croach committed
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/cocoapods/podfile.rb
8 lib/cocoapods/podfile.rb
@@ -223,7 +223,13 @@ def platform(name, target = nil)
when :ios
target = '4.3'
when :osx
- target = '10.6'
+ # Get the current version of OS X if we can, otherwise default to 10.6
+ begin
+ os_version = `sw_vers -productVersion`.chomp
+ target = os_version.split('.')[0, 2].join('.')
+ rescue
+ target = '10.6'
+ end
raise ::Pod::Podfile::Informative, "Unsupported platform: platform must be one of [:ios, :osx]"

0 comments on commit dec9d1c

Please sign in to comment.
Something went wrong with that request. Please try again.