             try write(to: r.path, settings: r.settings)
         }
     }
+
+    // Remove buildSettings from pbxproj
+
+    let contents: String = try pbxprojPath.read()
+
+    var result: [String] = []
+    var skip = false
+    let tabs = "\t\t\t"
+    let spaces = "           "
+    for line in contents.characters.split(separator: "\n", omittingEmptySubsequences: false) {
+        let l = String(line)
+        if l == "\(tabs)buildSettings = {" || l == "\(spaces)buildSettings = {" {
+            result.append(l)
+            skip = true
+        } else if skip == true && (l == "\(tabs)};" || l == "\(spaces)};") {
+            result.append(l)
+            skip = false
+        } else if skip == false {
+            result.append(l)
+        }
+    }
+    try pbxprojPath.write(result.joined(separator: "\n"))
 }
 
 main.run(version)

    //
    // read
    //
    let data: Data = try path.read()
    guard let pbxproj = Pbxproj(data: data) else {
        fatalError("Failed to parse Pbxproj")
    }

    Argument<Path>("PATH", description: "xcodeproj file", validator: dirExists),
    Argument<Path>("DIR", description: "output directory"),
    Flag("trim-duplicates", description: "extract duplicated lines to common xcconfigs.", default: true)
) { xcodeprojPath, dirPath, isTrimDuplicates in

    let pbxprojPath = xcodeprojPath + Path("project.pbxproj")
    if dirPath.isDirectory == false {
        try! dirPath.mkdir()
    }
