Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I resolve macOS Carthage hangs when running update?

Started working on a new project where I need to run "Carthage update" for a mix of private and public projects some of which have submodules. No matter what I do Carthage hangs with no indication of why. What can I do to determine the hangs, and then how do I fix those problems?

like image 510
David H Avatar asked Mar 21 '17 18:03

David H


People also ask

What is Carthage on mac?

Carthage is intended to be the simplest way to add frameworks to your Cocoa application. Carthage builds your dependencies and provides you with binary frameworks, but you retain full control over your project structure and setup. Carthage does not automatically modify your project files or your build settings.


1 Answers

Much of what I did to solve my problems can be found elsewhere, but no one site had it all. In the end I used a technique that I did not find but guessed at.

The root problem I had was adopting recommended security protection for my github account: two stage authentication and a passphrase for ssh. Both of these can be worked around, but unfortunately Cathage offers no "verbose" option to let a user determine what git commands it's executing - an option that would really help the user when it hangs. In my case (and probably most others) the root problem is that a git command run by Carthage wants to prompt the user for something, and Carthage has closed or redirected standard output.

1) Sierra and Git account/passwords

It seems that a recent Sierra point release changes how git credentials are cached. The proper way to do this now is using the Keychain. The procedure on how to direct git to use the Keychain is found here . Note that this technique only works for pure "account/password" authentication.

Before even trying Carthage, insure you can use git clone from the terminal to be sure all is well.

2) Two-step authentication

In this case, you need to use an authentication token. That token is used in place of the git password. Again, insure you can clone an appropriate repository before trying Carthage.

3) Passphrase for ssh access

If git uses ssh (as it may with sub-modules), then git will attempt to prompt for the passphrase, and as Carthage suppresses that you'll be left hanging. By adding a line to your ~/.ssh/config file (and do this at the BOTTOM of the file)

Host *
    UseKeychain yes

git will also use the Keychain for saving and retrieving the passphrase. You need to do this once via the Terminal to get it entered into the Keychain.

4) Still stuck?

If the above techniques don't help you, when Carthage hangs open a new terminal window and run ps -aef | grep git; what you'll then see are a few git commands. Hopefully you will see a git clone command as I did; copy that command to the clipboard.

Kill the Carthage command, then paste the line in Terminal and run the command (perhaps by editing it to remove extraneous options), and see what happens. With luck what you find will help you resolve your problem.

like image 84
David H Avatar answered Oct 11 '22 10:10

David H