Keep getting this error when trying to clone my Github repos. Any help would be appreciated! I am running on MacOS (M1)
Couldn't posix_spawn: error 2
Since macOS 12.3 removed the built-in Python@2.x, Sourcetree cannot open Mercurial projects normally after system upgrade.
Guess the reason is that the built-in Mercurial of Sourcetree depends on the built-in Python2 of macOS, but Python2 was removed, so it throws an error.
The solution is as follows:
1. Open Sourcetree preferences and switch to the Mercurial tab.
You can see the error message from Mercurial Version: Embedded Mercurial Couldn't posix_spawn: error 2.
2. Select Use System Mercurial,path like: /usr/local/Cellar/mercurial/6.1/lib/python3.10/site-packages/mercurial.
Choose according to the version of Mercurial you have installed. If you installed Mercurial using Homebrew, you can find its path through brew list mercurial.
That's it.
This doesn't seem to work. I get the same error using the Brew-installed version of Mercurial.
On my system it was installed at:
/opt/homebrew/Cellar/mercurial/6.1/lib/python3.10/site-packages/mercurial/
...but once I select that folder in SourceTree, it says the same error: "System Mercurial Couldn't posix_spawn: error 2"
Maybe it's still trying to use Python 2.7 still instead of Python 3.10?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Worked for me!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If I choose the mercurial location from brew I get the 'not found' error and am not able to select it in Sourcetree.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The only way I was able to get it to work was to modify the "hg_local" file inside the SourceTree.app package and replace the first line to point to the path of Python 3.10 that I installed via Homebrew <https://brew.sh>. And then set it to use the Embedded Mercurial.
The steps:
1. Install Python 3.10 via Homebrew <https://brew.sh>, or skip this and just try with the Python you already installed.
2. Select your copy of SourceTree.app in the Finder and right-click (aka Control-click) on the icon and choose "Show Package Contents".
3. Navigate to Contents/Resources/mercurial_local/, then open "hg_local" in a text editor (BBEdit or TextEdit). You'll have to drag and drop it onto the editor icon, as the Mac will only want to open the file in Terminal by default.
4. Change the first line to the path of the Python you installed. (I found Python 3.10 works fine with the embedded Mercurial.)
For example, change line 1 from:
#!/usr/bin/python
to:
#!/opt/homebrew/opt/python@3.10/bin/python3.10
(Note, this is where Python 3.10 installed for me, but might be very different for you. Confirm first.)
...and save the file.
5. Launch SourceTree and make sure you are in Embedded Mercurial mode, in Preferences > Mercurial > "Embedded Mercurial Version 4.6.1".
6. Don't let SourceTree update until they have fixed this issue themselves, otherwise it will undo the above edit on step #4 (or redo the edit after each update.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same issue for me, although I just had to change hashbang /she-bang to:
#!/usr/bin/python3, restart SourceTree and wait for it to be 'fixed' in the distro package. I installed hg with homebrew also. M1 Mac Monterey.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
IT WORKED FOR ME!!! I installed mercurial first using "brew install mercurial" then uninstalled the SourceTree and installed it back again!! Hope it helps !!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same problem after upgrading to 12.3... I am still on Intel. Git works, Mercurial does not
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it's actually related to the fact that Apple seems to have upgraded the default python to version 3 (at last).
But that breaks any hg (also on the command line).
On command line I can fix it by installing mercurial 6.1, but I cannot select that version as the external mercurial... Sourcetree reports 'mercurial not found in selected folder?)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Me too, after upgrading macOS 12.3, opening the Mercurial project in sourcetree will report an error. But the Git project works fine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same problem, I still can't fix this problem after adding the existing local repo on macOS 12.4 Apple M1 and SourceTree 4.1.8 (244).
And I get the 'not found' error when I choose the mercurial location from brew. I guess SourceTree don't support Mercurial 6.1.3 by Python 3.8.9.
Looks like official noticed this problem: https://jira.atlassian.com/browse/SRCTREE-7867. Let's look forward to hearing from their good news.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mine magically fixed itself after adding an existing local repo. If it wasn't that then idk what fixed it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
same problem. what is the solution? thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.