Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install git via homebrew on mac osx 10.10 results in: Error: Permission denied - /usr/local/lib/perl5/site_perl/5.18.2

Tags:

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?

like image 431
Niels Kristian Avatar asked Nov 07 '14 20:11

Niels Kristian


People also ask

How do I enable Git on Mac?

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.

What is the best way to install Git on Mac?

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.

How do I download Git on Mac using Xcode?

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.

How do I know if Git is installed on Mac terminal?

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.


2 Answers

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.

like image 143
Jonyzfu Avatar answered Sep 21 '22 15:09

Jonyzfu


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)/*

like image 20
Ryan Avatar answered Sep 22 '22 15:09

Ryan