Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brew update Fails With Ruby Error #1511

Closed
NotoriousWebmaster opened this issue Nov 15, 2016 · 14 comments
Closed

brew update Fails With Ruby Error #1511

NotoriousWebmaster opened this issue Nov 15, 2016 · 14 comments

Comments

@NotoriousWebmaster
Copy link

NotoriousWebmaster commented Nov 15, 2016

OSX 10.11.2

I'm getting this error:

Bender:local alfred$ brew update /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- mach (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/local/Library/Homebrew/extend/pathname.rb:2:in <top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /usr/local/Library/Homebrew/global.rb:3:in <top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/local/Library/brew.rb:15:in

'
Bender:local alfred$`

I imagine I need to update my Ruby or XCode?

Thanks for your help.

@MikeMcQuaid
Copy link
Member

cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew update should fix this for you.

@NotoriousWebmaster
Copy link
Author

Thx for the quick response @MikeMcQuaid ; sadly it still generates errors, though slightly different:

Bender:local alfred$ cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew update /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:inrequire': cannot load such file -- mach (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/local/Library/Homebrew/extend/pathname.rb:2:in<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /usr/local/Library/Homebrew/global.rb:3:in <top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/local/Library/brew.rb:15:in

'
warning: unable to unlink .yardopts: Permission denied
warning: unable to unlink CONTRIBUTING.md: Permission denied
warning: unable to unlink SUPPORTERS.md: Permission denied
fatal: cannot create directory at '.github': Permission denied
Bender:local alfred$`

@MikeMcQuaid
Copy link
Member

Ok: cd /usr/local && git fetch && git reset --hard origin/master && brew update

@NotoriousWebmaster
Copy link
Author

NotoriousWebmaster commented Nov 15, 2016

OK, here's what I got:

Bender:local alfred$ cd /usr/local && git fetch && git reset --hard origin/master && brew update
warning: unable to unlink .yardopts: Permission denied
warning: unable to unlink CONTRIBUTING.md: Permission denied
warning: unable to unlink SUPPORTERS.md: Permission denied
fatal: cannot create directory at '.github': Permission denied
Bender:local alfred$ ls -al
total 104
drwxrwxr-x@  25 root    wheel    850 15 Nov 10:09 .
drwxr-xr-x@  12 root    wheel    408 15 Oct  2015 ..
drwxrwxr-x   13 gadmin  admin    442 15 Nov 11:09 .git
-rw-r--r--    1 root    wheel    301 15 Nov 10:07 .gitignore
-rw-r--r--    1 root    wheel    261 15 Nov 10:08 .yardopts
-rw-r--r--    1 root    wheel   3160 15 Nov 10:09 CODEOFCONDUCT.md
-rw-r--r--    1 root    wheel   1103 15 Nov 10:09 CONTRIBUTING.md
drwxrwxr-x   12 gadmin  admin    408 14 Nov 18:03 Cellar
-rw-r--r--    1 root    wheel   1241 15 Nov 10:09 LICENSE.txt
drwxrwxr-x    7 gadmin  admin    238 15 Nov 10:09 Library
-rw-r--r--    1 root    wheel   2064 15 Nov 10:09 README.md
-rw-r--r--    1 root    wheel  23781 15 Nov 10:09 SUPPORTERS.md
drwxrwxr-x  116 gadmin  admin   3944  8 Nov 16:09 bin
drwxrwxr-x    6 gadmin  admin    204  7 Nov 16:16 etc
drwxrwxr-x    8 gadmin  admin    272 31 Oct  2014 git
lrwxr-xr-x    1 alfred  admin    127 22 Apr  2012 google_appengine -> /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine
drwxrwxr-x    9 gadmin  admin    306 22 May 10:54 hidden
drwxrwxr-x    7 gadmin  admin    238 16 Oct  2015 include
drwxrwxr-x   26 gadmin  admin    884 16 Oct  2015 lib
drwxrwxr-x    5 gadmin  admin    170 31 Oct  2014 libexec
drwxrwxr-x    4 gadmin  admin    136 31 Oct  2014 man
drwxrwxr-x    3 root    wheel    102  4 Jun 00:41 n
drwxrwxr-x   12 gadmin  admin    408  7 Nov 16:16 opt
drwxrwxr-x   18 gadmin  admin    612  5 Nov  2015 share
drwxrwxr-x    5 alfred  admin    170  7 Nov 16:15 var
Bender:local alfred$

Can I chown the files in this directory to alfred:admin?

@MikeMcQuaid
Copy link
Member

@NotoriousWebmaster Yeh, sudo chown -R alfred:admin /usr/local. You'll be able to back off some of that later.

@NotoriousWebmaster
Copy link
Author

Thanks @MikeMcQuaid!!! That worked.

When I did a second update I got these Unknown option messages, is this normal?

Bender:local alfred$ brew update
Unknown option: n
Unknown option: 1
Usage: head [-options] <url>...
    -m <method>   use method for the request (default is 'HEAD')
    -f            make request even if head believes method is illegal
    -b <base>     Use the specified URL as base
    -t <timeout>  Set timeout value
    -i <time>     Set the If-Modified-Since header on the request
    -c <conttype> use this content-type for POST, PUT, CHECKIN
    -a            Use text mode for content I/O
    -p <proxyurl> use this as a proxy
    -P            don't load proxy settings from environment
    -H <header>   send this HTTP header (you can specify several)

    -u            Display method and URL before any response
    -U            Display request headers (implies -u)
    -s            Display response status code
    -S            Display response status chain
    -e            Display response headers
    -d            Do not display content
    -o <format>   Process HTML content in various ways

    -v            Show program version
    -h            Print this message

    -x            Extra debugging output
Already up-to-date.
Bender:local alfred$

@MikeMcQuaid
Copy link
Member

@NotoriousWebmaster Sounds like you have a head in your $PATH that's not the system version.

@NotoriousWebmaster
Copy link
Author

Not sure how to address this. Here's my PATH:

Bender:mongodb alfred$ echo $PATH
/usr/local/bin:/opt/local/bin:/opt/local/sbin:/Users/alfred/.npm/bin:/Users/alfred/bin:/Applications/XAMPP/xamppfiles/bin:/Library/Frameworks/Python.framework/Versions/3.1/bin:/Users/alfred/Library/Android/sdk/platform-tools:/usr/bin:/bin:/usr/sbin:/sbin:
Bender:mongodb alfred$

@MikeMcQuaid
Copy link
Member

which head should return /usr/bin/head.

@NotoriousWebmaster
Copy link
Author

I can move XAMPP to the end of the PATH. Would that help?

Bender:mongodb alfred$ which head
/Applications/XAMPP/xamppfiles/bin/head
Bender:mongodb alfred$ ls -al /Applications/XAMPP/xamppfiles/bin/head
-r-xr-xr-x  1 root  wheel  14725 17 Nov  2014 /Applications/XAMPP/xamppfiles/bin/head
Bender:mongodb alfred$

@MikeMcQuaid
Copy link
Member

Yep.

@NotoriousWebmaster
Copy link
Author

Beautiful! That fixed it. Thanks.

@JohnBartlett
Copy link

Excellent work Mike!

FYI, this fixed my issues in OSX 10.12.5 also...

Thanks again,
John

@straube
Copy link

straube commented Aug 20, 2017

Based on the comments above, these steps – and in the following order – worked for me:

$ sudo chown -R $(whoami):admin /usr/local
$ cd /usr/local && git fetch && git reset --hard origin/master && brew update

@Homebrew Homebrew locked and limited conversation to collaborators Aug 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants