You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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.
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:
...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?
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.
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:
(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.)
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?)
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.