Hi I just tried installing git via homebrew on my mac - something is wrong. I had the github for mac app installed, but I tried removing that. The current git version in my system is:
Nielsk@~: $ git --version
git version 1.9.3 (Apple Git-50)
This is what happens if I try to install git via homebrew:
Nielsk@~: $ brew install git
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-2.1.3.y
######################################################################## 100,0%
==> Pouring git-2.1.3.yosemite.bottle.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
/usr/local/bin/git-credential-osxkeychain
The 'contrib' directory has been installed to:
/usr/local/share/git-core/contrib
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completion has been installed to:
/usr/local/share/zsh/site-functions
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied - /usr/local/lib/perl5/site_perl/5.18.2
Error: Permission denied - /usr/local/lib/perl5/site_perl/5.18.2
How can I solve this?
Git for Mac Installer The easiest way to install Git on a Mac is via the stand-alone installer: Download the latest Git for Mac installer. Follow the prompts to install Git. (Optional) To make Git remember your username and password when working with HTTPS repositories, configure the git-credential-osxkeychain helper.
Install Git on MacNavigate to the latest macOS Git Installer and download the latest version. Once the installer has started, follow the instructions as provided until the installation is complete. Open the command prompt "terminal" and type git version to verify Git was installed.
Install Git Using XcodeIts command-line tools include Git in the package. The output should display the latest Git release, as in the example below. If you do not have Git, it automatically asks you whether you want to install it. Confirm the installation, and Xcode sets up Git.
You can check your current version of Git by running the git --version command in a terminal (Linux, macOS) or command prompt (Windows). If you don't see a supported version of Git, you'll need to either upgrade Git or perform a fresh install, as described below.
I also met the same issue. I think we should change the readable permission to make sure any of the directories is readable by "all". So I tried the command: sudo chown -R $USER:admin /usr/local
and then: brew link --overwrite git
It works for me, hope it will also work for you.
From High Sierra, chown
of /usr/local
is not allowed. However you can still change permission the sub directories in /usr/local
.
In my case, I had to create Frameworks
in /usr/local
and sudo chown -R $(whom) Frameworks
. After that follow what brew doctor
says.
The better way is to create subdirectory whatever you need and run
sudo chown -R $(whoami) $(brew --prefix)/*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With