Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

/usr/local/Library/Homebrew/macos.rb:251:in `require': no such file to load -- macos/xcode (LoadError) #18600

Closed
fud opened this issue Mar 20, 2013 · 19 comments

Comments

@fud
Copy link

fud commented Mar 20, 2013

brew
/usr/local/Library/Homebrew/macos.rb:251:in require': no such file to load -- macos/xcode (LoadError) from /usr/local/Library/Homebrew/macos.rb:251 from /usr/local/Library/Homebrew/utils.rb:3:inrequire'
from /usr/local/Library/Homebrew/utils.rb:3
from /usr/local/Library/Homebrew/global.rb:7:in require' from /usr/local/Library/Homebrew/global.rb:7 from /usr/local/bin/brew:17:inrequire'
from /usr/local/bin/brew:17

@jacknagel
Copy link
Contributor

What goes git status say inside /usr/local? It appears your installation is corrupted.

@jacknagel
Copy link
Contributor

Depending on the state of the repository in /usr/local, you should be able to just git reset --hard, otherwise reinstall Homebrew.

@buunguyen
Copy link

I am having exactly the same issue. It just appeared out of nowhere today. Since I haven't used Homebrew for a couple of weeks, I'm not sure which system change caused it.

git status in /usr/local

# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .gitignore
#   CONTRIBUTING.md
#   Library/
#   README.md
#   bin/
nothing added to commit but untracked files present (use "git add" to track)

I already reinstalled Homebrew but the issue persists. Running Mountain Lion and latest version of XCode.

@emil79
Copy link

emil79 commented Mar 30, 2013

I'm seeing the same issue. I recently installed rvm (Ruby version manager) - could that have had something to do with it? I did a git status in /usr/local and it found lots of deleted files.

@MikeMcQuaid
Copy link
Member

@emil79 Yes, that could.
@buunguyen Did you install RVM? What happens when you run brew update?

@buunguyen
Copy link

No I don't have RVM. All brew commands, including brew update, show that error.

@MikeMcQuaid
Copy link
Member

brew doctor and brew --config output please.

@emil79
Copy link

emil79 commented Mar 31, 2013

I have now reinstalled homebrew as I couldn't wait, but this what I got from brew doctor:

[17:52:49] $ brew doctor
/usr/local/Library/Homebrew/macos.rb:249:in `require': no such file to load -- macos/xcode (LoadError)
    from /usr/local/Library/Homebrew/macos.rb:249
    from /usr/local/Library/Homebrew/utils.rb:3:in `require'
    from /usr/local/Library/Homebrew/utils.rb:3
    from /usr/local/Library/Homebrew/global.rb:5:in `require'
    from /usr/local/Library/Homebrew/global.rb:5
    from /usr/local/bin/brew:17:in `require'
    from /usr/local/bin/brew:17

@buunguyen
Copy link

I have the exact problem as @emil79 after reinstalling. Not just brew doctor, but every other brew command fails.

@MikeMcQuaid
Copy link
Member

Have you both already installed the Xcode CLT?

@zzzev
Copy link

zzzev commented Apr 1, 2013

I have the same issue. I have installed the XCode CLTs. I cannot re-install because when I attempt to install it says it's already installed, and I cannot do either the instructions there (brew cleanup will not run) or the uninstall script (brew --prefix will not run), because all brew commands, including brew doctor have the following output (note there's a different line number in macos.rb than the other paste in this thread; not sure if that's important):

/usr/local/Library/Homebrew/macos.rb:251:in `require': no such file to load -- macos/xcode (LoadError)
from /usr/local/Library/Homebrew/macos.rb:251
from /usr/local/Library/Homebrew/utils.rb:3:in `require'
from /usr/local/Library/Homebrew/utils.rb:3
from /usr/local/Library/Homebrew/global.rb:5:in `require'
from /usr/local/Library/Homebrew/global.rb:5
from /usr/local/bin/brew:17:in `require'
from /usr/local/bin/brew:17

EDIT: Update: I removed the /usr/local/Library folder based on comments on the gist that contains the uninstall script; it allowed me to re-install brew properly and appears to be working again. Obviously this is not necessarily a great idea.

@buunguyen
Copy link

Yes, I do have CLT (version 4.5.0.0.1.1249367152) installed.

@nalply
Copy link

nalply commented Apr 9, 2013

I had this problem after fixing the PATH because brew doctor said: Error: /usr/bin occurs before /usr/local/bin.

Perhaps I messed up Homebrew by running some things from /usr/bin instead of /usr/local/bin.

git reset --hard fixed Homebrew for me.

@purplehat7
Copy link

Where are you running git reset --hard? I'm having the same error from all brew commands, specifically:

/usr/local/bin/brew:17:in``require': no such file to load -- global (LoadError) from /usr/local/bin/brew:17

Running git status in /usr/local gives me the following error:

fatal: Not a git repository (or any of the parent directories): .git

@nalply
Copy link

nalply commented Jun 18, 2013

In /usr/local I think. However it seems that you deleted important files, and git reset --hard won't help you. Try and reinstall Homebrew.

@purplehat7
Copy link

This is my output from running ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" as per the install instructions on http://mxcl.github.io/homebrew/:

`==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press ENTER to continue or any other key to abort
==> Downloading and Installing Homebrew...
remote: Counting objects: 116787, done.
remote: Compressing objects: 100% (55416/55416), done.
remote: Total 116787 (delta 80895), reused 93716 (delta 60419)
Receiving objects: 100% (116787/116787), 18.83 MiB | 115 KiB/s, done.
Resolving deltas: 100% (80895/80895), done.
From https://github.com/mxcl/homebrew

  • [new branch] master -> origin/master
    error: unable to create symlink Library/ENV/pkgconfig/10.4 (Permission denied)
    fatal: cannot create directory at 'Library/ENV/pkgconfig/10.5': Permission denied
    Failed during: git reset --hard origin/master`

I've also tried uninstalling Homebrew via the uninstall_brew.sh script but bash uninstall_brew.sh requires that I run brew update, which--being a brew command--triggers the error:

/usr/local/bin/brew:17:in require': no such file to load -- global (LoadError) from /usr/local/bin/brew:17

Since bash uninstall_brew.sh failed, I ran rm -rf /usr/local/Library/Homebrew/ but trying to reinstall via ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" generates the same error as above.

Thanks in advance for any help!

@nalply
Copy link

nalply commented Jun 18, 2013

Try to change the owner of Library/ENV/pkgonfig to your own. Perhaps by: sudo chown $(whoami) -R /usr/local then try to reinstall, but I am not sure whether this helps you. Your system seems to be quite messed up.

@purplehat7
Copy link

Running sudo chown $(whoami) -R /usr/local/ gives chown: -R: No such file or directory

@nalply
Copy link

nalply commented Jun 19, 2013

This is not a support forum. Additionally: These sudo commands are powerful. If you don't know what you do you can completely destroy your system. I do not feel at ease to give help to you anymore.

@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
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

8 participants