16
votes

When I run git add -p, I see:

Can't locate Git.pm in @INC (@INC contains:
/usr/local/lib/perl5/site_perl
/Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12
/Network/Library/Perl/5.12/darwin-thread-multi-2level
/Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.4
/System/Library/Perl/5.12/darwin-thread-multi-2level
/System/Library/Perl/5.12
/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.12 .) at
/usr/local/libexec/git-core/git-add--interactive line 7.

I just got a new mac running 10.8.4. I installed the XCode Command Line Tools.

6
Did you setup Git as well? - uday
Did you ever resolve this issue? Did you already have Git installed? If not, how did you install it? - user456814

6 Answers

11
votes

On OSX (and Homebrew) I fixed this by simply reinstalling:

$ brew uninstall git
$ brew install git
1
votes

I had the same issue.

Finally I had resolved it by installing git from source and having my installation in my PATH rather the one from XCode.

1
votes

Git.pm is usually shipped as part of your Git installation, not as part of Perl.

As a result, it will be located somewhere relative to the git program. Try looking in a lib directory nearby whatever the output of which git is. For example, if which git returns /opt/local/bin/git the try looking under the directory /opt/local/lib, etc.

0
votes

I met the same issue on my Mac OS 10.9.4, and fixed it with the following command:

$ sudo ln -s /Library/Developer/CommandLineTools/usr/share/git-core /usr/share/
0
votes

It can be fixed via SymLink. I just couldn't be asked to do that, but instead I reinstall git using brew uninstall git and brew install git, which does the trick for me.

0
votes

On macOS Mojave, git perl lib is in /Library/Developer/CommandLineTools/usr/share/git-core/perl. So, it can be fixed by:

export PERLLIB=/Library/Developer/CommandLineTools/usr/share/git-core/perl:$PERLLIB