Quick guide (and personal memo) on how to get git-svn to run on macOS with brew.
git-svn is written in perl and running on the perl5 binary bundled with git.
The issue is: the Perl module "SVN::Core" cannot be found. (Obviously, it hasn't be installed).
The error message looks like this:
Can't locate SVN/Core.pm in @INC
The solution is straightforward: provide the installation path of SVN::Core to git-svn.
- make sure you are using homebrew git. if not:
brew install git
- make sure you have homebrew svn. if not:
brew install subversion
subversion has it's Perl bindings bundled, so we just need to inform git-svn about them. - find the path to subversion's Perl bindings. it should be around
/usr/local/Cellar/subversion/1.14.1/lib/perl5/site_perl/5.18.4/darwin-thread-multi-2level/
(YMMV on the svn version) - open
/usr/local/Cellar/git/2.30.2/libexec/git-core/git-svn
(YMMV on the git version) in a text editor.
the first line below the shebang, beginning withuse lib
is the one we need to change:
#!/usr/bin/perl
use lib (split(/:/, $ENV{GITPERLLIB} || '/usr/local/Cellar/git/2.30.2/share/perl5:/Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level:/Library/Developer/CommandLineTools/Library/Perl/5.18/darwin-thread-multi-2level'));
- insert the path to the svn Perl module after the first path here:
i.e. after/usr/local/Cellar/git/2.30.2/share/perl5
,
insert/usr/local/Cellar/subversion/1.14.1/lib/perl5/site_perl/5.18.4/darwin-thread-multi-2level/
(separate paths using colons:
).
the code should now read:
#!/usr/bin/perl
use lib (split(/:/, $ENV{GITPERLLIB} || '/usr/local/Cellar/git/2.30.2/share/perl5:/usr/local/Cellar/subversion/1.14.1/lib/perl5/site_perl/5.18.4/darwin-thread-multi-2level/:/usr/local/Cellar/perl/5.32.1_1/lib/perl5/site_perl/5.32.1/darwin-thread-multi-2level/:/Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level:/Library/Developer/CommandLineTools/Library/Perl/5.18/darwin-thread-multi-2level'));
git svn help
and all others commands should work now.
thanks a lot, this really helped!! Can't believe it is this easy!