How to update just one library from the Cartfile with Carthage?
Asked Answered
W

9

94

My Cartfile has many libraries. When I do carthage update it goes through all the libraries. That can take very long time.

Is there a way to update just a single library with carthage? Something like this? (this will not work)

carthage update "evgenyneu/moa"
Waterresistant answered 3/6, 2015 at 7:0 Comment(0)
L
167

From 0.12 version build, checkout, and update take an optional space separated list of dependencies

For a Cartfile like the following

github "Alamofire/Alamofire"
github "ReactiveX/RxSwift"

You could choose to update one dependency

carthage update Alamofire

or multiple dependencies

carthage update Alamofire RxSwift

If you need to add flags, add them last:

carthage update Alamofire --platform iOS
Leonardoleoncavallo answered 5/4, 2016 at 8:47 Comment(6)
carthage update Box --no-use-binaries --platform iOS // if you need to specify additional flagsGarthgartner
@Alex Salom: Box being the name of the repo in the Cartfile? would be easier to understand if you used something more familiar like AlamoFire maybe? And what is the Result portion? Another repo name or?Signalize
@GitSyncApp, yeah you have to write the names of the dependencies separated by spaces. I edited my answerLeonardoleoncavallo
@MartinRomañuk what exactly doesn't work? I've just tried the example above with carthage bootstrap and it only processed one dependency from the two defined in the Cartfile. Take a look at the screenshot from my terminal pasteboard.co/I9bARyq.pngLeonardoleoncavallo
@AlexSalom to be fair, you are using bootstrap while the answer says to use update. With bootstrap you are downloading whatever the Carfile.resolved says, it won't update.Nub
carthage update Box --platform ios --use-ssh --cache-builds --use-xcframeworksHairdresser
N
13

Carthage supports updating single dependencies now.If you have something like this in your Cartfile:

github "bitstadium/HockeySDK-iOS"

Then you can update only this one dependency by running

carthage update HockeySDK-iOS
Negative answered 5/7, 2016 at 11:43 Comment(0)
J
9

Right now the answer is no... If your run carthage help update you'll see

Update and rebuild the project's dependencies

[--configuration Release]
    the Xcode configuration to build (ignored if --no-build option is present)

[--platform all]
    the platform to build for (ignored if --no-build option is present)

[--verbose]
    print xcodebuild output inline (ignored if --no-build option is present)

[--no-build]
    skip the building of dependencies after updating

[--use-ssh]
    use SSH for downloading GitHub repositories

[--use-submodules]
    add dependencies as Git submodules

[--no-use-binaries]
    check out dependency repositories even when prebuilt frameworks exist (ignored if --no-build option is present)

[--color auto]
    whether to apply color and terminal formatting (one of ‘auto’, ‘always’, or ‘never’)

[/path/to/your/app]
    the directory containing the Carthage project

As you can see there is no mention to an option to specify only one dependency to update.

You should open an issue on the project repo asking to support that.

Justiceship answered 19/6, 2015 at 4:28 Comment(0)
R
9

If the framework isn't stored in GitHub, or you are using the git identifier, and your cartfile looks like this:

git "ssh://[email protected]/teamname/repo-name.git" ~> 1.0

then you can update only that one running the following command

carthage update repo-name
Rumple answered 11/8, 2017 at 19:53 Comment(0)
G
7

I tried all of the answers, and for me only removing or commenting temporarily the repositories and after running

carthage update --platform ios

after I restore the Catfile to previous state

Giacinta answered 8/10, 2018 at 23:30 Comment(0)
G
5

I ended up writing my own script that builds a single dependency for me and merges it with my existing dependencies. You can find it at https://github.com/ruipfcosta/carthage-workarounds.

Genital answered 25/11, 2015 at 22:27 Comment(0)
B
1

Carthage --no-use-binaries and specific schema

[Carthage flow]

carthage [update|bootstrap|checkout|build] [dependency1] [dependency2] [--no-use-binaries] [--platform <name>]

//--no-use-binaries - does not use prebuild binary and use source code
//--platform - specify a platform

The longest phase is a carthage build(xcodebuild) step because:

  1. carthage build generates fat binary which is built using lipo[About]

  2. Carthage builds all shared frameworks schemes of a project. If you know which exactly schema which you need you can:

    • [UI] Open built project from Carthage/Checkouts folder -> Manage Schemes... -> check specific schemes

    • [Manually] Leave specific schemes at xcschemes folder .../Carthage/Checkouts/<dependency>/<project>.xcodeproj/xcshareddata/xcschemes/<schema>.xcscheme

[Carthage --no-use-binaries]

Butcherbird answered 24/4, 2020 at 12:16 Comment(0)
H
0

Swift 5

//MARK:- Step 1
carthage update KeychainAccess --platform iOS

carthage update SDKNAME(like i mention KeychainAccess upper) --platform iOS

if you face an Error like this

//MARK:- If this error occur
error: unable to find utility "xcodebuild", not a developer tool or in PATH

Then use Part 1 in Terminal Again

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

and again

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Hassanhassell answered 28/2, 2020 at 5:57 Comment(0)
D
0

Looks like carthage update repo-name doesn't work on Carthage 0.36.0. I solved this problem by manually updating Carthage.resolved. For example, add to a Cartfile a new dependency:

github "konkab/AlamofireNetworkActivityLogger" ~> 3.0.0

Add to a Cartfile.resolved a new dependency manually:

github "konkab/AlamofireNetworkActivityLogger" "3.0.0"

Then do carthage bootstrap to only update one dependency:

carthage bootstrap

It will use Carthage.resolved and just add one dependency.

Danaus answered 28/10, 2020 at 13:56 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.