git: svn is not a git command - Mac git: svn is not a git command - Mac git git

git: svn is not a git command - Mac


I found a simple fixed solution for macOS Big Sur v11.1 (20C69) on GitHub.

  1. make sure install git, svn, perl with brew.

    brew install gitbrew install perlbrew install subversion
  2. edit /usr/local/Cellar/git/2.30.0/libexec/git-core/git-svn.

    replace #!/usr/bin/perl with #!/usr/local/bin/perl

  3. git svn works.


The above solution only works under perl 5.32.0.

When I updated the perl to 5.32.1, git svn can no longer work.

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

I found a solution on GitHub.

Now subversion built with system perl, so we can add an environmentvariable to solve this problem:

export PERL5LIB=/usr/local/lib/perl5/site_perl/#{perl_version}/darwin-thread-multi-2level

You should replace #{perl_version} with system perl's version.

For macOS Big Sur:

export PERL5LIB=/usr/local/lib/perl5/site_perl/5.28.2/darwin-thread-multi-2level


UPDATE: SEPTEMBER 2020

It seems the end is here. Following the original suggestion will delete subversion forever. I found a verified version of Subversion for MacOS and downloaded and installed it. I then needed to add Subversion to the $PATH variable to supersede Apple's svn (which just prints a message saying subversion is no longer included). To add it, add this line to your ~/.zprofile:

export PATH=/opt/subversion/bin:$PATH

This will fix svn. I still have not figured out how to fix git svn.

NB: I also am aware that one can get subversion from homebrew, but homebrew is prohibited by my company's policies. If homebrew works better for somebody, please post your results here.

ORIGINAL ANSWER: MARCH 2020

Same thing happened to me today. After software update, git svn and svn are gone. It seems that Apple is deprecating Subversion in XCode:

Command line tool support for Subversion — including svn, git-svn, and related commands — is no longer provided by Xcode. If you need Subversion or related command line tools, install the Command Line Tools package by running xcode-select --install. (50266910)

In the mean time, I was able to resolve this situation by deleting the XCode command line tools and reinstalling them:

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

After that, git svn and svn were back. Hopefully that will give us a stay of execution before final deprecation and deletion.


  1. First install git and svn with brew
brew install gitbrew install svn
  1. Use system default perl at /usr/bin/perl

if you installed perl with brew, please uninstall it.

brew uninstall perl

use which perl to check if using the system default perl at /usr/bin/perl. Make sure the git-svn use the #!/usr/bin/perluse following command to check which perl is git-svn using

$ head -1 $(brew --prefix)/opt/git/libexec/git-core/git-svn#!/usr/bin/perl
  1. check you svn's perl version at /usr/local/Cellar/subversion/1.14.1/lib/perl5/site_perl/5.18.4

  2. If you got error Can't locate SVN/Core.pm in @INCyou also need to set PERL5LIB path, for Catalina:

export PERL5LIB=/usr/local/lib/perl5/site_perl/5.18.4/darwin-thread-multi-2level

for Big Sur:

export PERL5LIB=/usr/local/lib/perl5/site_perl/5.28.2/darwin-thread-multi-2level

Reference: https://github.com/Homebrew/homebrew-core/issues/52490