Homebrew / legacy-homebrew

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

Homebrew Install Fails (Mountain Lion) #14319

Closed niczak closed 12 years ago

niczak commented 12 years ago

I am trying to install Homebrew on a machine that has never had it installed before. Here is what happens I try to install:

➜ ~ ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go) ==> This script will install: /usr/local/bin/brew /usr/local/Library/Formula/... /usr/local/Library/Homebrew/... /usr/local/share/man/man1/brew.1

Press enter to continue ==> Downloading and Installing Homebrew... remote: Counting objects: 77014, done. remote: Compressing objects: 100% (37110/37110), done. remote: Total 77014 (delta 52447), reused 61187 (delta 39093) Receiving objects: 100% (77014/77014), 10.99 MiB | 4.66 MiB/s, done. Resolving deltas: 100% (52447/52447), done. From https://github.com/mxcl/homebrew

If I try the installer again after that I get: ➜ ~ ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go) /usr/local/.git already exists!

I have done everything outlined here: https://gist.github.com/1860902 and still no luck.

mxcl commented 12 years ago

You already had some files in /usr/local. Delete /usr/local and try again.

mxcl commented 12 years ago

Though, I'm a little confused, unless there is already a bin/brew file there, I wouldn't expect this to fail. What files do you have in /usr/local/bin?

Update: I tested it, it'll work if files already exist.

niczak commented 12 years ago

@mxcl I'd rather not delete what is in that directory (I did delete the .git directory in /usr/local) so is there any other way to get this to work? Quite a few things install to /usr/local so I would assume others have gotten this to work when there are things already in that directory. I don't have a /usr/local/bin directory if that helps any.

mxcl commented 12 years ago

Yes, this does work. Recently I changed the installer to use git rather than to untar a tarball, so I assume this is related.

If you have no "bin", then I cannot explain why it errors out like so:

Untracked working tree file 'bin' would be overwritten by merge. Failed during: git pull origin master

mxcl = Stuck.

niczak commented 12 years ago

@mxcl Shoot, yeah it doesn't make a whole heck of a lot of sense to me either. I do have MySQL installed in /usr/local so I'd really like to avoid blowing that entire directory away. Perhaps I'll just hold off for the next version of the installer.

mxcl commented 12 years ago

I'll ponder on this some more and get back to you.

For now, if you download the script at https://raw.github.com/mxcl/homebrew/go, you can try editing it mid-way so it picks the tar route rather than the git route. You can execute the script after with a plain ruby script-name command.

mxcl commented 12 years ago

In fact this command by itself is effectively the whole install:

cd /usr/local && /bin/bash -o pipefail -c '/usr/bin/curl -skSfL https://github.com/mxcl/homebrew/tarball/master | /usr/bin/tar xz -m --strip 1'

The rest is checks and changing the permissions on /usr/local so that the files can be extracted there.

niczak commented 12 years ago

@mxcl That (cd /usr/local && /bin/bash -o pipefail -c '/usr/bin/curl -skSfL https://github.com/mxcl/homebrew/tarball/master | /usr/bin/tar xz -m --strip 1') worked like a charm. I was able to run 'brew update' after that and am now in good shape. Thank you for the help!

antbryan commented 12 years ago

I get the same error on a fresh 10.8.1 w/ xcode installed.

after trying (cd /usr/local && /bin/bash -o pipefail -c '/usr/bin/curl -skSfL https://github.com/mxcl/homebrew/tarball/master | /usr/bin/tar xz -m --strip 1') then 'brew update' I get

error: The following untracked working tree files would be overwritten by checkout: .gitignore Library/Aliases/0mq Library/Aliases/4store Library/Aliases/Secret Rabbit Code Library/Aliases/alut Library/Aliases/android Library/Aliases/apache-activemq Library/Aliases/apache-fop Library/Aliases/aws-as Library/Aliases/aws-mon Library/Aliases/beanstalkd Library/Aliases/bjam Library/Aliases/boehmgc Library/Aliases/boost-jam Library/Aliases/bzr Library/Aliases/cowthink Library/Aliases/cpanm Library/Aliases/ctags-exuberant Library/Aliases/db Library/Aliases/dbus Library/Aliases/dejagnu Library/Aliases/eyeD3 Library/Aliases/fastcgi Library/Aliases/firefly Library/Aliases/fluidsynth Library/Aliases/fsa Library/Aliases/gearmand Library/Aliases/gjstest Library/Aliases/gnu-scientific-library Library/Aliases/google-go Library/Aliases/gpg Library/Aliases/gpg2 Library/Aliases/gs Library/Aliases/gtk Library/Aliases/gtypist Library/Aliases/hashdeep Library/Aliases/hg Library/Aliases/htop Library/Aliases/hudson Library/Aliases/hugs Library/Aliases/ipsum Library/Aliases/jocr Library/Aliases/jslint Library/Aliases/lcms Library/Aliases/lcms2 Library/Aliases/leg Library/Aliases/libcryptopp Library/Aliases/libgd Library/Aliases/libgeoip Library/Aliases/libjpeg Library/Aliases/libjpg Library/Aliases/liblabjackusb Library/Aliases/libmad Library/Aliases/libmcrypt Library/Aliases/libnettle Library/Aliases/liboggz Library/Aliases/libqrencode Library/Aliases/libtag Library/Aliases/libtasn Library/Aliases/littlecms Library/Aliases/mc Library/Aliases/mediainfo Library/Aliases/mongo Library/Aliases/mp4box Library/Aliases/node.js Library/Aliases/nodejs Library/Aliases/nsis Library/Aliases/o-caml Library/Aliases/ocaml Library/Aliases/ocio Library/Aliases/offlineimap Library/Aliases/oiio Library/Aliases/omake Library/Aliases/ooc Library/Aliases/openmpi Library/Aliases/openocd Library/Aliases/p4 Library/Aliases/p4d Library/Aliases/pgrep Library/Aliases/pipeviewer Library/Aliases/pkgconfig Library/Aliases/pkill Library/Aliases/pocketsphinx Library/Aliases/postgres Library/Aliases/rbx Library/Aliases/ree Library/Aliases/saga Library/Aliases/shell-fm Library/Aliases/slang Library/Aliases/sphinxbase Library/Aliases/sqlite3 Library/Aliases/stax-sdk Library/Aliases/style Library/Aliases/svn Library/Aliases/tinyfugue Library/Aliases/twolame Library/Aliases/umfpack Library/Aliases/unix2dos Library/Aliases/urxvt Library/Aliases/usb-multiplex-daemon Library/Aliases/xmlsec1 Library/Aliases/zmq Library/Contributions/brew_bash_completion.sh Library/Contributions/brew_fish_completion.fish Library/Contributions/brew_zsh_completion.zsh Library/Contributions/cmds/brew-beer.rb Library/Contributions/cmds/brew-dirty.rb Library/Contributions/cmds/brew-graph Library/Contributions/cmds/brew-grep Library/Contributions/cmds/brew-leaves.rb Library/Contributions/cmds/brew-linkapps.rb Library/Contributions/cmds/brew-ls-taps.rb Library/Contributions/cmds/brew-man Library/Contributions/cmds/brew-mirror-check.rb Library/Contributions/cmds/brew-pull.rb Library/Contributions/cmds/brew-readall.rb Library/Contributions/cmds/brew-server Library/Contributions/cmds/brew-services.rb Library/Contributions/cmds/brew-switch.rb Library/Contributions/cmds/brew-test-bot.rb Library/Contributions/cmds/brew-test-bot/brew-test-bot.commit.html.erb Library/Contributions/cmds/brew-test-bot/brew-test-bot.css Library/Contributions/cmds/brew-test-bot/brew-test-bot.index.html.erb Library/Contributions/cmds/brew-tests.rb Library/Contributions/cmds/brew-unpack.rb Library/Contributions/cmds/brew-which.rb Library/Contributions/manpages/brew.1.md Library/Formula/a2ps.rb Library/Formula/a52dec.rb Library/Formula/aacgain.rb Library/Formula/aalib.rb Library/Formula/aamath.rb Library/Formula/aardvark_shell_utils.rb Library/Formula/abcde.rb Library/Formula/abcl.rb Library/Formula/abiword.rb Library/Formula/abnfgen.rb Library/Formula/abook.rb Library/Formula/abyss.rb Library/Formula/ace.rb

Aborting Error: Failure while executing: git checkout -q master

mxcl commented 12 years ago

@antbryan delete those files and try again.

antbryan commented 12 years ago

thanks! I tried that & the error repeated.

I believe downloading the command line tools within xcode fixed it. I thought it was command line tools OR xcode, not both.

either way, it works now on 10.8.1. awesome tool!

LandonSchropp commented 12 years ago

I'm trying to install Homebrew on a fresh copy of OS X 10.8.0. I've downloaded Xcode and the Xcode command line tools. Here's my output:

$ ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/Formula/...
/usr/local/Library/Homebrew/...
/usr/local/share/man/man1/brew.1

Press enter to continue
==> Downloading and Installing Homebrew...
remote: Counting objects: 78871, done.
remote: Compressing objects: 100% (37709/37709), done.
remote: Total 78871 (delta 53885), reused 62869 (delta 40345)
Receiving objects: 100% (78871/78871), 11.15 MiB | 1.48 MiB/s, done.
Resolving deltas: 100% (53885/53885), done.
From https://github.com/mxcl/homebrew
 * branch            master     -> FETCH_HEAD
error: Untracked working tree file '.gitignore' would be overwritten by merge.
Failed during: git pull origin master
mxcl commented 12 years ago

@LandonSchropp do you already have a /usr/local/.gitignore file? If so, delete it.

mxcl commented 12 years ago

I have updated the installer so that this issue should no longer occur.

danielwestendorf commented 12 years ago

This is failing for me. OSX 10.8.1, Xcode and command line tools installed. I had homebrew installed when I was running 10.7 prior to upgrading.

$ rm bin/ .gitignore .git/
rm: bin/: is a directory
rm: .git/: No such file or directory
$ rm -rf bin/ .gitignore .git/
$ pwd
/usr/local
$ ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press enter to continue
==> Downloading and Installing Homebrew...
error: The requested URL returned error: 400 while accessing https://github.com/mxcl/homebrew/info/refs
fatal: HTTP request failed
Failed during: git fetch origin master:refs/remotes/origin/master -n

After removing the directories again and using the above mentioned cd /usr/local && /bin/bash -o pipefail -c '/usr/bin/curl -skSfL https://github.com/mxcl/homebrew/tarball/master | /usr/bin/tar xz -m --strip 1' it installs, and I have access to the brew command. However, when I try brew update

$ brew update Initialized empty Git repository in /usr/local/.git/ error: The requested URL returned error: 400 while accessing https://github.com/mxcl/homebrew.git/info/refs fatal: HTTP request failed Error: Failure while executing: git fetch origin

Sharpie commented 12 years ago

@danielwestendorf

Looks like a transient network issue. The GitHub status site shows service disruptions have occurred yesterday and today. Just try brew update again.

danielwestendorf commented 12 years ago

I was having the problem the night previous, which is why I posted.

I figured that something was wacky with my 10.8 install, so I re-installed OSX 10.8 from scratch. The install still fails.

$ ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press enter to continue
==> Downloading and Installing Homebrew...
error: Could not resolve host: (nil); nodename nor servname provided, or not known while accessing https://github.com/mxcl/homebrew/info/refs
fatal: HTTP request failed
Failed during: git fetch origin master:refs/remotes/origin/master -n

When I navigate to https://github.com/mxcl/homebrew/info/refs in a web browser, I get a 404. Obviously I can navigate to https://github.com without issue.

$ curl -I https://github.com/mxcl/homebrew/info/refs
HTTP/1.1 404 Not Found
Server: nginx
Date: Thu, 20 Sep 2012 16:59:03 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Status: 404 Not Found
Cache-Control: no-cache
Set-Cookie: _gh_sess=BAh7BzoQX2NzcmZfdG9rZW4iMUl3eHpML1lWSzVhSlZ4MEpmZTV5aWdkWWJheXBQRzA4WG9PekFoRUNDSWc9Og9zZXNzaW9uX2lkIiVmZWIyZDQyZTVjZDZmMGMxNmFlYjQwY2QyYzk3NmUzOA%3D%3D--701ba3e1dc1110cfac2ff33aed3ce001ee3eec9a; path=/; expires=Sat, 01-Jan-2022 00:00:00 GMT; secure; HttpOnly
Content-Length: 21851
$ curl -I https://github.com
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 20 Sep 2012 16:59:28 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Status: 200 OK
X-Frame-Options: deny
Cache-Control: private, max-age=0, must-revalidate
ETag: "e6c4775615c2b4234e1a433f2844ce0d"
Strict-Transport-Security: max-age=2592000
X-Runtime: 15
Set-Cookie: _gh_sess=BAh7BzoQX2NzcmZfdG9rZW4iMXR0K2hTSlRWcGtQakJZMnN2SllMR2Y3bytwWjE4cXZ5Rk1hOTZhL3FqaDQ9Og9zZXNzaW9uX2lkIiUwMGNkMjQ5YzkxY2Q2OTJkN2NmZGI3YTUxZTNmYTFkNA%3D%3D--1d95c36ccd9388ee79c7a478a6ead5ad517fb33e; path=/; expires=Sat, 01-Jan-2022 00:00:00 GMT; secure; HttpOnly
Content-Length: 22836

Installing homebrew with cd /usr/local && /bin/bash -o pipefail -c '/usr/bin/curl -skSfL https://github.com/mxcl/homebrew/tarball/master | /usr/bin/tar xz -m --strip 1' works, but when I try to update homebrew I get

$ brew update
error: pathspec 'master' did not match any file(s) known to git.
Error: Failure while executing: git checkout -q master

I thought this was a problem isolated to my laptop, which is why I re-installed OSX. I have another computer on the same network with an existing installation of homebrew that can update without issue. I think this is a problem with the install script. Any more info I can provide to help narrow this down?

danielwestendorf commented 12 years ago

I resolved my problems by replacing all instances of https://github.com/mxcl/homebrew with git://github.com/mxcl/homebrew.git in the install script. After doing so, it worked like a charm!

wenyhooo commented 9 years ago

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

wenyhooo commented 9 years ago

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