On OSX using sourcetree / git-svn getting "Can't locate SVN/Core.pm in @INC "
I hit this missing SVN/Core.pm
issue recently with el capitain.
Fix I used was from Paul Schreiber's blog :
sudo mkdir /Library/Perl/5.18/auto
sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level/SVN /Library/Perl/5.18/darwin-thread-multi-2level
sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level/auto/SVN /Library/Perl/5.18/auto/
Commenters below, say this worked on sierra and high sierra too.
Or, if you don't have Xcode
, just CommandLineTools
(this is on ElCapitan 10.11.6
):
sudo ln -s /Library/Developer/CommandLineTools/Library/Perl/5.18/darwin-thread-multi-2level/SVN /usr/local/git/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level/SVN
sudo ln -s /Library/Developer/CommandLineTools/Library/Perl/5.18/darwin-thread-multi-2level/auto/SVN /usr/local/git/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level/auto/SVN
If you previously linked some older version or just made a mistake so it gives you: File exists
, then you should first do
sudo unlink /usr/local/git/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level/SVN
for whichever file was reported as already existent, of course.
EDIT Dir doesn't exist: (suggested by @rogeriopradoj)
mkdir -p /usr/local/git/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level
EDIT Sierra:
After upgrading to Sierra I lost CommandLineTools
, so I just had to reinstall it and everything was back to normal.
This will prompt you to install just the CommandLineTools
, not the whole XCode
.
xcode-select --install
Hope this helps someone :)
In my case, it is because different versioned perl was installed by brew as dependency of some formula, and override the system's default version.
So the resolution for me is to relieve the overridden as described following.
when type which perl
and perl -v
, I find it not the system default version:
# locate programs
faner@MBP-FAN:~|⇒ whereis perl
/usr/bin/perl
# locate a program file in the user's path
faner@MBP-FAN:~|⇒ which perl
/usr/local/bin/perl
faner@MBP-FAN:~|⇒ perl -v
This is perl 5, version 26, subversion 1 (v5.26.1) built for darwin-thread-multi-2level
which should be v5.18.2 according to the git svn
error messages.
I guess it is because the different versioned perl was installed by brew as dependency of some formula, and override the system default version.
faner@MBP-FAN:~|⇒ brew uses perl --installed
subversion
To prove it, try to move /usr/bin
before /usr/local/bin
in $PATH, then perl was fallback to the system's default version:
faner@MBP-FAN:~|⇒ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
faner@MBP-FAN:~|⇒ PATH=/usr/bin:$PATH
faner@MBP-FAN:~|⇒ echo $PATH
/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
faner@MBP-FAN:~|⇒ whereis perl
/usr/bin/perl
faner@MBP-FAN:~|⇒ which perl
/usr/bin/perl
faner@MBP-FAN:~|⇒ perl -v
This is perl 5, version 18, subversion 2 (v5.18.2) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)
and perl -V
list the @INC just satisfy the Can't locate SVN/Core.pm in @INC
requirements:
faner@MBP-FAN:~|⇒ perl -V
Summary of my perl5 (revision 5 version 18 subversion 2) configuration:
@INC:
/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.2
/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
type git svn
and everything works well!
faner@MBP-FAN:~|⇒ git svn --version
git-svn version 2.15.1 (Apple Git-101) (svn 1.9.7)