Homebrew / legacy-homebrew

💀 The former home of Homebrew/homebrew (deprecated)
https://brew.sh
26.96k stars 11.34k forks source link

brew install git requires sudo? #79

Closed walter closed 15 years ago

walter commented 15 years ago

I may be doing something wrong, but when I tried "brew install git" without sudo, I get an error like this during the make install:

... install -d -m 755 '/usr/local/Cellar/git/1.6.4.2/bin' install -d -m 755 '/usr/local/Cellar/git/1.6.4.2/libexec/git-core' install git-fast-import git-hash-object git-index-pack git-merge-index git-merge-tree git-mktag git-pack-redundant git-patch-id git-shell git-show-index git-unpack-file git-update-server-info git-upload-pack git-var git-http-push git-daemon git-imap-send git-am git-bisect git-difftool--helper git-filter-branch git-lost-found git-merge-octopus git-merge-one-file git-merge-resolve git-mergetool git-mergetool--lib git-parse-remote git-pull git-quiltimport git-rebase--interactive git-rebase git-repack git-request-pull git-sh-setup git-stash git-submodule git-web--browse git-add--interactive git-difftool git-archimport git-cvsexportcommit git-cvsimport git-cvsserver git-relink git-send-email git-svn git-instaweb '/usr/local/Cellar/git/1.6.4.2/libexec/git-core' install git git-upload-pack git-receive-pack git-upload-archive git-shell git-cvsserver '/usr/local/Cellar/git/1.6.4.2/bin' make -C templates DESTDIR='' install install -d -m 755 '/usr/local/Cellar/git/1.6.4.2/share/git-core/templates' (cd blt && tar cf - .) | \ (cd '/usr/local/Cellar/git/1.6.4.2/share/git-core/templates' && umask 022 && tar xfo -) tar: Unrecognized archive format: Inappropriate file type or format tar: Error exit delayed from previous errors. make[1]: * [install] Error 1 make: * [install] Error 2 ==> Error: Failure while executing: make install

If I do "sudo brew install git" I get:

$ sudo brew install git ==> Downloading http://kernel.org/pub/software/scm/git/git-1.6.4.2.tar.bz2

100.0%

==> ./configure --prefix=/usr/local/Cellar/git/1.6.4.2 ==> make install ==> Downloading http://kernel.org/pub/software/scm/git/git-manpages-1.6.4.2.tar.bz2

100.0%

/usr/local/Cellar/git/1.6.4.2: 379 files, 15M, built in 65 seconds

Looks to me like the git package includes things for Perl that need to go under other places besides /usr/local and that is why the permission problem crops up. So the git package requires sudo.

If a package is going to require sudo, it would be good to warn the user if they try to run the command without it. Was a pain to figure this out.

I'm pretty sure you won't be able to enforce that packages should be installable without sudo, but if you lead people down the "don't use sudo" path, it would be good to note the exceptions.

Cheers, Walter

walter commented 15 years ago

Ok, this was probably my error. I had thought that I had made /usr/local directory under my user and group, but I had only made the subdirectories that way. In other words, I mangle this step:

sudo chown -R whoami:staff brew --prefix

If I had done that, I probably wouldn't have needed the sudo.

Sorry about the false alarm.

walter commented 15 years ago

I spoke too soon. Even after that sudo chown command, brew git install still errors out with what I pasted in unless you use sudo.

walter commented 15 years ago

I spoke too soon again! D'oh! Sorry for wasting your time. Operator error on my part. I was confused during the process of manually merging git clone of homebrew with .pkg installed version that I grabbed to install git.

I thought I had everything in order under /usr/local, but in fact I hadn't changed the permissions to my user and staff group correctly after all.

All good now.

mxcl commented 15 years ago

Heh, glad to hear it worked out :)