             buildPhases.append(copyFilesPhase.reference)
         }
 
-        if !carthageFrameworks.isEmpty {
+        let carthageFrameworksToEmbed = carthageDependencies
+            .filter { ($0.embed ?? true) }
+            .map { $0.reference }
+        if !carthageFrameworksToEmbed.isEmpty {
 
             if target.type.isApp && target.platform != .macOS {
-                let inputPaths = carthageFrameworks.map { "$(SRCROOT)/\(carthageBuildPath)/\(target.platform)/\($0)\($0.contains(".") ? "" : ".framework")" }
+                let inputPaths = Set(carthageFrameworksToEmbed).map { "$(SRCROOT)/\(carthageBuildPath)/\(target.platform)/\($0)\($0.contains(".") ? "" : ".framework")" }
                 let carthageScript = PBXShellScriptBuildPhase(reference: generateUUID(PBXShellScriptBuildPhase.self, "Carthage" + target.name), files: [], name: "Carthage", inputPaths: inputPaths, outputPaths: [], shellPath: "/bin/sh", shellScript: "/usr/local/bin/carthage copy-frameworks\n")
                 addObject(carthageScript)
                 buildPhases.append(carthageScript.reference)

        return "\(carthagePath)/\(platformName)"
    }

    func getCarthageFrameworks(target: Target) -> [String] {
        var frameworks: [String] = []
        for dependency in target.dependencies {
            switch dependency.type {
            case .carthage: frameworks.append(dependency.reference)
            case .target:
                if let target = spec.getTarget(dependency.reference) {
                    frameworks += getCarthageFrameworks(target: target)
                }
            default: break
            }


    func generateTarget(_ target: Target) throws -> PBXNativeTarget {

        let carthageDependencies = getAllCarthageDependencies(target: target)

        let sourcePaths = target.sources.map { basePath + $0 }
        var sourceFilePaths: [Path] = []
