Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-svn Can't locate SVN/Core.pm after fresh installation of macOS Catalina 10.15.4

Recently I reinstalled macOS Catalina 10.15.4. After I installed Command_Line_Tools_11.4.1, it told me svn is no longer working with Xcode. Then I installed both git and svn by brew, hopefully git-svn would work. Unfortunately got this error message:

Can't locate SVN/Core.pm in @INC (you may need to install the SVN::Core module) (@INC contains: /usr/local/Cellar/git/2.26.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 /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /usr/local/Cellar/git/2.26.2/share/perl5/Git/SVN/Utils.pm line 6.

Both git & svn are the latest version.

Please help me out.

like image 368
xxoommd Avatar asked May 06 '20 14:05

xxoommd


3 Answers

Finally I figure it out!!!

Open the git-svn file (perl script, in my case file location is /usr/local/opt/git/libexec/git-core/git-svn), change the first line #!/usr/bin/perl to #!/usr/local/bin/perl

And it works!

I guess system perl doesn't include perl SVN/Core, but brew perl has it (dependency of brew svn).

like image 146
xxoommd Avatar answered Nov 12 '22 19:11

xxoommd


Solution for MacOS Big Sur 11.5

After struggling with this error for hours:

Can't locate SVN/Core.pm in @INC (you may need to install the SVN::Core module)

I've finally found a solution that actually works.

If you run:

brew reinstall subversion

It will print a message like this:

The perl bindings are located in various subdirectories of:
  /usr/local/opt/subversion/lib/perl5

Then you just need to run this command before using git svn to load the SVN module from the correct path:

export PERL5LIB=/usr/local/opt/subversion/lib/perl5/site_perl/5.30.2/darwin-thread-multi-2level
like image 20
collimarco Avatar answered Nov 12 '22 21:11

collimarco


Solution for those, who, like me - want to use Sourcetree client on macOS Catalina with git-svn:

First step:

brew install git
brew install perl
brew install subversion

edit
/usr/local/Cellar/git/git_version/libexec/git-core/git-svn
replace
#!/usr/bin/perl
with
#!/usr/local/bin/perl

Second step, install missed perl modules:

cpan SVN::Core
cpan Term::ReadKey

Third step, configure SourceTree:

In Sourcetree->Preferences - set option "use system git", from:

/usr/local/Cellar/git/git_version/git
like image 6
Torello Avatar answered Nov 12 '22 21:11

Torello