Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I had been doing most of my POSIX development on something other than my Mac after upgrading from Mountain Lion to Mavericks, and when I came back, Homebrew was not functioning at a smoke-test level. All calls seemed to get an allergic reaction to characters used to identify if a file was a tar.gz:

bash-3.2# brew install git
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': /usr/local/Library/Homebrew/extend/pathname.rb:262: invalid multibyte escape: /^\037\213/ (SyntaxError)
invalid multibyte escape: /^\037\235/
invalid multibyte escape: /^\xFD7zXZ\x00/
    from     /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /usr/local/Library/Homebrew/global.rb:1:in `<top (required)>'
    from     /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from     /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /usr/local/bin/brew:10:in `<main>'

I searched for the error and turned up someone asking a similar question on copyquery.com; I reinstalled the OSX command line tools and then attempted to do a clean reinstall of Homebrew. That failed too:

...
==> Downloading and installing Homebrew...
remote: Counting objects: 162348, done.
remote: Compressing objects: 100% (45938/45938), done.
remote: Total 162348 (delta 115308), reused 162338 (delta 115300)
Receiving objects: 100% (162348/162348), 30.36 MiB | 3.31 MiB/s, done.
Resolving deltas: 100% (115308/115308), done.
From https://github.com/Homebrew/homebrew
 * [new branch]      master     -> origin/master
error: unable to unlink old 'Library/Homebrew/test/mach/a.out' (Permission denied)
error: git checkout-index: unable to create file Library/Homebrew/test/mach/fat.bundle (Permission denied)
error: unable to unlink old 'Library/Homebrew/test/mach/fat.dylib' (Permission denied)
error: git checkout-index: unable to create file Library/Homebrew/test/mach/i386.bundle (Permission denied)
error: unable to unlink old 'Library/Homebrew/test/mach/i386.dylib' (Permission denied)
error: git checkout-index: unable to create file Library/Homebrew/test/mach/x86_64.bundle (Permission denied)
error: unable to unlink old 'Library/Homebrew/test/mach/x86_64.dylib' (Permission denied)
Checking out files: 100% (3131/3131), done.
fatal: Could not reset index file to revision 'origin/master'.
Failed during: git reset --hard origin/master

And Homebrew doesn't want to be installed as root; it will bail if ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" is installed as root.

I asked one time before if things were as bad as I thought after the MacPorts project systematically bit off more than it could chew and had breakage (like Gentoo, but you can usually search for error messages and find a Gentoo community solution within hours of something breaking--not so with what MacPorts was chewing!). I was told that the only reason it wasn't worse was that MacPorts etc. were available and provided a better alternative.

Right now I have a Mac running OSX 10.9 Mavericks, command line tools installed, and VMware Fusion with several clean Linux virtual machines available. If I want to do Unixy hacking (get the AngularJS tutorial working, and then tinker and hack a game into place), what are my live options for a development environment worth serious consideration? I'll be sad if I can't use MacOSX as a hacker's Unix, but if the critical path to developer sanity includes something that doesn't run under Mavericks, I'm willing to swallow the irony and work with a Linux environment.

This may risk being a subjective questions, but given Mavericks plus any Linux I want, what are my serious options for tinkering with a software project?

Thanks,

--

When I ran "brew doctor", I got:

Warning: An outdated version of Git was detected in your PATH.
Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
Please upgrade: brew upgrade git

  ^C

Inner Sanctum ~ $ brew upgrade git
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Error: git not installed

Would it help to install Git via a native installer?

--EDIT--

I've tried to uninstall Homebrew completely per instructions and reinstall, but it errors out:

Inner Sanctum ~ $ rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

Inner Sanctum ~ $ sudo /usr/local/bin/uninstall-homebrew.sh 
brew update first!

Inner Sanctum ~ $ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 162492, done.
remote: Compressing objects: 100% (45968/45968), done.
remote: Total 162492 (delta 115424), reused 162478 (delta 115414)
Receiving objects: 100% (162492/162492), 30.32 MiB | 736.00 KiB/s, done.
Resolving deltas: 100% (115424/115424), done.
From https://github.com/Homebrew/homebrew
 * [new branch]      master     -> origin/master
error: unable to unlink old 'Library/Homebrew/test/mach/a.out' (Permission denied)
error: unable to create file Library/Homebrew/test/mach/fat.bundle (Permission denied)
error: unable to unlink old 'Library/Homebrew/test/mach/fat.dylib' (Permission denied)
error: unable to create file Library/Homebrew/test/mach/i386.bundle (Permission denied)
error: unable to unlink old 'Library/Homebrew/test/mach/i386.dylib' (Permission denied)
error: unable to create file Library/Homebrew/test/mach/x86_64.bundle (Permission denied)
error: unable to unlink old 'Library/Homebrew/test/mach/x86_64.dylib' (Permission denied)
Checking out files: 100% (3132/3132), done.
fatal: Could not reset index file to revision 'origin/master'.
Failed during: git reset --hard origin/master

I've tried a couple of variants, and for everything but one run I've tried the attempt to install brew results in errors like the permission denied error above. I've presently done find / -name Homebrew, and deleted everything, and run the curl etc. command from /, in case it will work better for Library to be in fact /Library. Now it worked. I'm not sure which change worked. Which change made it work?

share|improve this question

migrated from serverfault.com Mar 25 at 20:49

This question came from our site for professional system and network administrators.

    
"Which change made it work?". The answer is within your question. You had errors related to bad permissions at /usr/local/Library/Homebrew/.... Then you deleted that folder per your find thus "fixing" the errors. You should accept Mr ghoppe's awesome answer. –  Cawas Jun 17 at 5:47
add comment

2 Answers 2

I see a few issues from what you posted.

error: unable to unlink old 'Library/Homebrew/test/mach/a.out' (Permission denied)

It seems to me you have a permissions issue perhaps from the leftover previous installation of Homebrew. You should remove all traces of the previous installation before you reinstall.

And Homebrew doesn't want to be installed as root

Why on earth would you want to install homebrew as root? The whole point of the project is to keep homebrew in /usr/local so that you don't need sudo.

Warning: It appears you have MacPorts or Fink installed. Software installed with other package managers causes known problems for Homebrew.

You should also ensure MacPorts is uninstalled and that you've uninstalled Fink. They could cause issues with software installed by homebrew.

Warning: An outdated version of Git was detected in your PATH. Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.

This indicates to me that you still have an old version of git in your PATH, probably installed with another package manager. OS X Mavericks comes with git version 1.8.5.1

What is the result of the whereis git command from the terminal? usr/bin/git is the OSX install of git.

Follow the guides to completely remove previous MacPorts or Fink installs and ensure the old directories are removed from your PATH variable.

PS.

I'll be sad if I can't use MacOSX as a hacker's Unix

That would make me sad too. :(

I find homebrew invaluable and easy to work with. In summary, it seems you just have old software installed (and perhaps extraneous directories in your PATH) and need to clear it out, check your permissions, and reinstall homebrew from scratch.

share|improve this answer
    
For removing all traces, consider this newer script (referenced on the "official" link there): gist.github.com/SteveBenner/11254428 –  Cawas Jun 17 at 5:35
add comment

I'd recommend to start from

brew doctor

which should point you at potential problems and tells you how to address them.

share|improve this answer
    
The question does this and shows the output - what different options should he have done? –  Mark Mar 26 at 17:03
1  
@Mark op did it after the advice, edited the question and that yielded to the much formidable answer by ghoppe. This was a very valid advice, even if not properly updated in response. It got bad downvote there by whoever. –  Cawas Jun 17 at 5:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.