macos 使用svn报错

Mac os在用svn检出项目时报错:

can't locate SVN/Core.pm in @INC (you may need to install the SVN::Core module) (@INC contains: /usr/local/git/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level /usr/local/git/lib/perl5/site_perl/5.18.2 /usr/local/git/lib/perl5/site_perl /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 .) at /usr/local/git/lib/perl5/site_perl/Git/SVN/Utils.pm line 6.
BEGIN failed--compilation aborted at /usr/local/git/lib/perl5/site_perl/Git/SVN/Utils.pm line 6.
Compilation failed in require at /usr/local/git/lib/perl5/site_perl/Git/SVN.pm line 25.
BEGIN failed--compilation aborted at /usr/local/git/lib/perl5/site_perl/Git/SVN.pm line 32.
Compilation failed in require at /usr/local/git/libexec/git-core/git-svn line 21.
BEGIN failed--compilation aborted at /usr/local/git/libexec/git-core/git-svn line 21.

在命令行下运行“git svn”,也是报这个错,百度了一番,找到比较靠谱的解决方案:
1.安装Xcode,运行

sudo xcodebuild -license

2.安装 Command Line Tools

xcode-select --install 

3.安装homebrew

4.用homebrew安装perl

brew install perl

5.安装Cpanm

brew install cpanm

6.安装SVN::Core

sudo cpan SVN::Core 

7.添加环境变量

运行命令: open .bash_profile
在打开的文件里加入:export PATH=/Library/Developer/CommandLineTools/usr/bin:$PATH
保存文件后,再运行:source .bash_profile

8.重装git,svn

brew reinstall git
brew reinstall subversion

完成以上步骤后,重新运行:git svn
没有报错,就可以继续使用svn了,

备注:有些第一次这样做完,运行“git svn”, 可能还会报如下错误:

git: 'svn' is not a git command. See 'git --help'.

The most similar commands are
    fsck
    mv
    show

出现这个错误不要慌,依次运行以下两个命令即可:

sudo rm -Rf /Library/Developer/CommandLineTools
sudo xcode-select --install

你可能感兴趣的:(macos 使用svn报错)