Mindaugas Jačionis Mindaugas Jačionis - 18 days ago 11
Git Question

Homebrew install fails while copying files

I run this:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


I get prompt:

==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew


After I click "return"(enter button) I get this error:

==> Downloading and installing Homebrew...
fatal: cannot copy '/usr/local/git/share/git-core/templates/hooks/pre-receive.sample' to '/usr/local/Homebrew/.git/hooks/pre-receive.sample': Permission denied
Failed during: git init -q


Any ideas what kind of error I am facing and what can be done? It is not really clear for me as it is first time I am facing something like this.

Answer

You are getting permission denied when downloading the files into /usr/local.

This folder often belongs to root. This is a known issue with brew. Fix it by doing

sudo chown $(whoami) /usr/local

and then re-run the installer.

Comments