SourceTree command line tools installation failed
Asked by Yann:

Context:

* OS X Yosemite 10.10.5
* SourceTree Version 2.0.5.3

I click SourceTree \> Install Command Line Tools, enter my password and get the following error message:

Installation failed

Unable to install command line tools, please refer to the system logs for more details.

Then a second one:

Installation failed

Failed to install command line tools, please see the system log for details.

Any guidance to solve this problem?

Yann


Answers:
author: Philip Borenstein
body: This has been annoying me for a while. Here's a workaround that works for me:

`$ ln -s /Applications/SourceTree.app/Contents/Resources/stree /usr/local/bin/`

I use homebrew, so `/usr/local/bin` is already in my path and owned by me (instead of root)

comments: author: Kevin Peters
body: Thanks for posting this workaround. It worked great for me!


author: blockloop
body: This is what I was looking for. Thank you.


author: Alberto Forni
body: Thanks for the workaround! Cheers.


author: Akos Maurer-Somogyi
body: Thanks, it works!


author: Kevin Kirchner
body: Works for me! Thanks!


author: khan.fan
body: great. it works. Thanks a lot.


author: wanderlima
body: Thanks!! ;)


author: Sorin Sbarnea
body: There is a bug opened for this <https://jira.atlassian.com/browse/SRCTREE-3172> - follow it.


author: Philip Borenstein
body: Still a problem in SourceTree Version 2.2.2 (51), but a little different. Now the application just quits unexpectedly.

Workaround (<https://answers.atlassian.com/questions/31657961/answers/32988936> ) seems to still work.


author: Chetan Sachdev
body: I am facing the same issue. Have you figured out a solution yet?


author: Nic Brough -Adaptavist-
body: What does the system log say?

comments: author: Yann
body: In Console.app, I was able to find the following log message:

10/12/15 10:20:15.599 AM SourceTree\[2892\]: Failed to install privileged helper: Error Domain=CFErrorDomainLaunchd Code=4 "The operation couldn't be completed. (CFErrorDomainLaunchd error 4.)"

Is there any other place to look for?


author: Nic Brough -Adaptavist-
body: That usually means you don't have the right permissions to install the software. Are you running the installation with a privileged account?


author: Yann
body: Yes, it is an administrator account


author: Nic Brough -Adaptavist-
body: Ok, you probably need to expand on the error a little to find out what it was failing to do. I've seen a very similar (different numbers, but the rest was the same) error when trying to install on a Mac with no admin access, but it went through fine when I became an admin. So I'm afraid I might be stuck


author: Yann
body: I don't know if its relevant but there's also a spindump message: 10/13/15 11:05:50.955 AM spindump\[385\]: Saved spin report for SourceTree version 2.0.5.3 (2.0.5.3) to /Library/Logs/DiagnosticReports/SourceTree_2015-10-13-110550_sofia.spinWhich links to the following report:Date/Time: 2015-10-13 11:05:43 +0200OS Version: 10.10.5 (Build 14F27)Architecture: x86_64Report Version: 21Command: SourceTreePath: /Applications/SourceTree.app/Contents/MacOS/SourceTreeVersion: 2.0.5.3 (2.0.5.3)PID: 838Event: spin-liteDuration: 6.40s (process was unresponsive for 2 seconds before sampling)Steps: 65 (100ms sampling interval)Hardware model: iMac8,1Active cpus: 2Fan speed: 699 rpmHeaviest stack for the main thread of the target process:65 ??? (SourceTree + 8704) \[0x10c521200\]65 NSApplicationMain + 1832 (AppKit + 12868) \[0x7fff82606244\]65 -\[NSApplication run\] + 594 (AppKit + 551667) \[0x7fff82689af3\]65 -\[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:\] + 346 (AppKit + 593496) \[0x7fff82693e58\]65 _DPSNextEvent + 1828 (AppKit + 596989) \[0x7fff82694bfd\]65 _NSHandleCarbonMenuEvent + 277 (AppKit + 1420512) \[0x7fff8275dce0\]65 _HandleMenuSelection2 + 446 (HIToolbox + 614654) \[0x7fff90f670fe\]65 MenuSelectCore(MenuData\*, Point, double, unsigned int, OpaqueMenuRef\*\*, unsigned short\*) + 702 (HIToolbox + 615553) \[0x7fff90f67481\]65 FinishMenuSelection(SelectionData\*, MenuResult\*, MenuResult\*) + 96 (HIToolbox + 612873) \[0x7fff90f66a09\]65 SendMenuItemSelectedEvent + 188 (HIToolbox + 613168) \[0x7fff90f66b30\]65 SendMenuCommandWithContextAndModifiers + 59 (HIToolbox + 613261) \[0x7fff90f66b8d\]65 SendHICommandEvent(unsigned int, HICommand const\*, unsigned int, unsigned int, unsigned char, void const\*, OpaqueEventTargetRef\*, OpaqueEventTargetRef\*, OpaqueEventRef\*\*) + 428 (HIToolbox + 360261) \[0x7fff90f28f45\]65 SendEventToEventTarget + 40 (HIToolbox + 122038) \[0x7fff90eeecb6\]65 SendEventToEventTargetInternal(OpaqueEventRef\*, OpaqueEventTargetRef\*, HandlerCallRec\*) + 386 (HIToolbox + 32686) \[0x7fff90ed8fae\]65 DispatchEventToHandlers(EventTargetRec\*, OpaqueEventRef\*, HandlerCallRec\*) + 1260 (HIToolbox + 35692) \[0x7fff90ed9b6c\]65 NSSLMMenuEventHandler + 724 (AppKit + 2346347) \[0x7fff8283fd6b\]65 -\[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:\] + 107 (AppKit + 3258546) \[0x7fff8291e8b2\]65 -\[NSMenu _internalPerformActionForItemAtIndex:\] + 35 (AppKit + 3258982) \[0x7fff8291ea66\]65 -\[NSMenu performActionForItemAtIndex:\] + 131 (AppKit + 3259136) \[0x7fff8291eb00\]65 _os_activity_initiate + 75 (libsystem_trace.dylib + 3287) \[0x7fff8522bcd7\]65 -\[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:\] + 114 (AppKit + 2443644) \[0x7fff8285797c\]65 -\[NSMenuItem _corePerformAction\] + 382 (AppKit + 2444366) \[0x7fff82857c4e\]65 -\[NSApplication sendAction:to:from:\] + 452 (AppKit + 2444977) \[0x7fff82857eb1\]65 _os_activity_initiate + 75 (libsystem_trace.dylib + 3287) \[0x7fff8522bcd7\]65 ??? (SourceTree + 208875) \[0x10c551feb\]65 ??? (SourceTree + 613396) \[0x10c5b4c14\]64 ??? (SourceTree + 612533) \[0x10c5b48b5\]60 ??? (SourceTree + 611828) \[0x10c5b45f4\]60 AuthorizationCreate + 151 (Security + 742023) \[0x7fff84062287\]60 xpc_connection_send_message_with_reply_sync + 200 (libxpc.dylib + 32169) \[0x7fff83844da9\]60 semaphore_wait_trap + 10 (libsystem_kernel.dylib + 70938) \[0x7fff921d651a\]\*60 semaphore_wait_continue + 0 (kernel + 1353536) \[0xffffff800034a740\]Binary Images:0x10c51f000 - 0x10c7c1fff com.torusknot.SourceTreeNotMAS 2.0.5.3 (2.0.5.3) \<05BD6566-0F56-3C43-BB9B-7EC796720431\> /Applications/SourceTree.app/Contents/MacOS/SourceTree0x7fff82603000 - 0x7fff83184fff com.apple.AppKit 6.9 (1348.17) \<E485D56D-3E72-34B7-99BB-BFDEE2D07BF5\> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit0x7fff8383d000 - 0x7fff83865fff libxpc.dylib (559.40.1) \<5C829202-962E-3744-8B50-00D38CC88E84\> /usr/lib/system/libxpc.dylib0x7fff83fad000 - 0x7fff84223fff com.apple.security 7.0 (57031.40.6) \<FCCCC4FD-043A-30CA-9997-4211CA0E9297\> /System/Library/Frameworks/Security.framework/Versions/A/Security0x7fff8522b000 - 0x7fff85231fff libsystem_trace.dylib (72.20.1) \<840F5301-B55A-3078-90B9-FEFFD6CD741A\> /usr/lib/system/libsystem_trace.dylib0x7fff90ed1000 - 0x7fff911d6fff com.apple.HIToolbox 2.1.1 (758.7) \<E3129A67-BDF9-333D-9C9C-A95C8F0EF71C\> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox0x7fff921c5000 - 0x7fff921e2fff libsystem_kernel.dylib (2782.40.9) \<16AD15EF-3DAE-3F63-9D26-26CCE1920762\> /usr/lib/system/libsystem_kernel.dylib\*0xffffff8000200000 - 0xffffff80009fffff kernel (2782.40.9) \<58F06365-45C7-3CA7-B80D-173AFD1A03C4\> /System/Library/Kernels/kernel


author: Mike James
body: Hi Any progress with this? I have OSX 10.10.4 and SourceTree: 2.0.5.5


author: Kris Baker
body: I'm getting the same error on OSX 10.11 and SourceTree 2.0.5.5. In the case of OSX 10.11, could it be related to the System Integrity Protection (SIP/rootless) feature of 10.11?


author: Chetan Sachdev
body: My log message shows as below:22/10/15 15:54:22,535 smd\[540\]: App "com.torusknot.SourceTreeNotMAS" did not pass helper check "com.atlassian.SourceTreePrivilegedHelper2".22/10/15 15:54:22,536 SourceTree\[9128\]: Failed to install privileged helper: Error Domain=CFErrorDomainLaunchd Code=4 "The operation couldn't be completed. (CFErrorDomainLaunchd error 4.)"22/10/15 15:59:11,367 smd\[540\]: App "com.torusknot.SourceTreeNotMAS" did not pass helper check "com.atlassian.SourceTreePrivilegedHelper2".22/10/15 15:59:11,367 SourceTree\[9128\]: Failed to install privileged helper: Error Domain=CFErrorDomainLaunchd Code=4 "The operation couldn't be completed. (CFErrorDomainLaunchd error 4.)"


author: nabgilby
body: If the stree link doesn't work, manually download and install the mercurial command line tools for from here, not the SoureTree website:

<https://www.mercurial-scm.org/wiki/Download>


author: Geoffrey Emerson
body: Just got this error with my first use of Sourcetree. Not very auspicious...

I installed the app through a download from the website. I have no idea how to "check the logs".

Also, the app installed itself into my user directory's Application folder, so the path for the workaround suggested by [Philip Borenstein](https://answers.atlassian.com/questions/users?username=557058%7C58512267-821b-4a6e-90fd-109a436ba9f1) is a bit different. Other than that, it worked.


author: Marvin Ellis
body: The proposed workaround doesn't work for me. I use home-brew as well


author: Ninan John
body: I had to add the Sourcetree.app file to Applications manually and then it worked.


author: rowen
body: I'm seeing the same problem with 2.3. It's disappointing that Atlassian has not fixed this. I have a number of other apps that install command-line tools with no problem.

Making a symlink to the stree binary in the application, as Philip Borenstein suggested earlier, is a good solution:

```
ln -s /Applications/SourceTree.app/Contents/Resources/stree /usr/local/bin/
```


author: Olivier Andriessen
body: Same, this is still a problem in 2.2.3 (56)


author: Nikolaj Andersen
body: I'm as well getting this error. Any update on this?


author: Joe Johnson
body: I'm getting the same error. Oddly, I just downloaded / installed the latest version a few minutes ago... and, this (very obvious bug) is still not fixed! WOW!


author: Sorin Sbarnea
body: Any solutions, or bugs raise on the sourcetree project?


author: Yann
body: No