diff --git a/lib/xcode/install.rb b/lib/xcode/install.rb
index <HASH>..<HASH> 100644
--- a/lib/xcode/install.rb
+++ b/lib/xcode/install.rb
@@ -496,8 +496,14 @@ HELP
     end
 
     def install_components
-      Dir.glob("#{@path}/Contents/Resources/Packages/*.pkg").each do |pkg|
-        `sudo installer -pkg #{pkg} -target /`
+      # starting with Xcode 9, we have `xcodebuild -runFirstLaunch` available to do package
+      # postinstalls using a documented option
+      if Gem::Version.new(@version) >= Gem::Version.new('9')
+        `sudo #{@path}/Contents/Developer/usr/bin/xcodebuild -runFirstLaunch`
+      else
+        Dir.glob("#{@path}/Contents/Resources/Packages/*.pkg").each do |pkg|
+          `sudo installer -pkg #{pkg} -target /`
+        end
       end
       osx_build_version = `sw_vers -buildVersion`.chomp
       tools_version = `/usr/libexec/PlistBuddy -c "Print :ProductBuildVersion" "#{@path}/Contents/version.plist"`.chomp
use new -runFirstLaunch flag for postinstalls >= 9