I am trying to update brew on my Mac OS X machine so I can update php. However, when trying to run brew install, I get this error:
error: The following untracked working tree files would be overwritten by merge:
Library/Homebrew/extend/enumerable.rb
Please move or remove them before you can merge.
Aborting
Error: Failure while executing: git pull --quiet origin refs/heads/master:refs/remotes/origin/master
brew doctor:
Warning: Broken symlinks were found. Remove them with brew prune:
/usr/local/bin/wget
/usr/local/share/man/man1/wget.1
/usr/local/Library/LinkedKegs/wget
Check the solution here
https://github.com/Homebrew/homebrew/issues/21002
in Short
cd /usr/local
git status
git reset --hard origin/master
git clean -df
Type brew doctor and do what it tells you.
brew install is not what you are looking for. I believe if you do this
brew update
brew upgrade
You should be good. If you want more info you should check here https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md#faq
Related
screenshot of actual error message
I have tried all the alternative ways to install jenkins on my macbook air but with no lack. I will appreciate anyone with the current solution to this.
This is the error message I get after running brew install jenkins:
Error: No similarly named formulae found.
Error: No available formula or cask with the name "jenkins".
It was migrated from homebrew/cask to homebrew/core.
I also get a "fata" message
fatal: Needed a single revision
I am very knew to Jenkins and trying to learn usage.
enter image description here
brew doctor
then
Homebrew/homebrew-core was not tapped properly! Run:
rm -rf "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core"
brew tap homebrew/core
then
brew install jenkins-lts
Run this command in terminal:
rm -fr $(brew --repo homebrew/core)
Then try:
brew install jenkins
It works
Have a look on this page : https://www.jenkins.io/download/lts/macos/
You must use brew install jenkins-lts to install jenkins.
$ brew update
Error: homebrew-core is a shallow clone. To `brew update` first run:
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow
I tried to run above command: git ... --unshallow
but I got another error:
fatal: dumb http transport does not support shallow capabilities
$ brew -v
Homebrew 2.6.0-104-g24f7898
Homebrew/homebrew-core (git revision b1ef15; last commit 2020-12-05)
Homebrew/homebrew-cask (git revision 443e7; last commit 2020-08-27)
Anyone can help?
I dug a little after trying to deal with the git repo, but the simplest thing that fixed it for me was untapping and then retapping the casks repo
brew untap homebrew/cask
brew tap homebrew/cask
that put everything back in order.
I haven't RTFM'd lately, but I'm guessing this has something to do with how casks seem to be moving into the main homebrew repo (or at least that's how it seems as a naive user).
I tried to run:
$ git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch
then:
$ git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow
brew update seems OK now.
In my case I was getting this
$ brew update
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Error: Fetching /usr/local/Homebrew/Library/Taps/myf/homebrew-formulas failed!
Notice the myf/homebrew-formulas in the last line.
This is one of my old repos not accessible anymore.
I got it solved with
$ brew untap myf/homebrew-formulas
Untapping myf/formulas...
Untapped 5 formulae (37 files, 63KB).
Other commands I tried
$ brew upgrade
$ brew update-reset
$ brew doctor
While executing the following command:
brew install opencv
I am encountered with the following exception:
Error: gobject-introspection: uninitialized constant Language::Python::Shebang
Could you please help me find the root cause for this and resolve it?
Language::Python::Shebang is the replacement for Language::Python.rewrite_python_shebang, which was deprecated in Homebrew 2.3.0
So you are likely using a version of Homebrew prior to 2.3.0 You can check your Homebrew version with brew --version.
Just doing brew update should update Homebrew to the latest version.
If you at some point added or changed a formula and worked locally on it you could be on a feature branch or your Homebrew working directory is changed so it does not update the master branch.
In these cases try the following:
cd /usr/local/Homebrew
git status
Discard or git stash your changes or git checkout master if you are on a feature branch
Once the working directory is clean you can brew update to update Homebrew
First time running brew since 10.9 upgrade.
From the output below, should I just remove Library/Formula/ant.rb and Library/Formula/apple-gcc42.rb? Also, unclear why git pull is failing. Thanks for any help
525 [projects]$ brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew.git
HEAD: 27c26faf7b958de6028ad55be8ccc5a57b094d3f
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.9-x86_64
Xcode: 5.0.2
GCC-4.2: build 5666
LLVM-GCC: build 0
Clang: 5.0 build 500
X11: N/A
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/*****/.rvm/rubies/ruby-2.0.0-p195/bin/ruby
526 [projects]$ brew update
error: The following untracked working tree files would be overwritten by merge:
Library/Formula/ant.rb
Library/Formula/apple-gcc42.rb
Please move or remove them before you can merge.
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
This fixed it for me
cd `brew --prefix`/Homebrew
git fetch origin
git reset --hard origin/master
brew update worked fine after that
Solution
You might still find..
brew update not working after git pull origin master
Here what you need to do.
cd /usr/local
git pull origin master
brew install git
Now you might already have git on your System,
but what this will do it that now.
Your broken brew update will automatically be updated before at first run..
Here is the link to the origin issue in HomeBrew. brew stuck
My brew update was hanging and doing nothing. I am on OSX 10.12.5 and none of the above worked for me and I have no .git in usr/local, only in usr/local/Homebrew.
I ran brew update --debug --verbose and brew update and that fixed the issue, see this issue: https://github.com/Homebrew/brew/issues/895
I simply removed the .git directory inside of the /usr/local directory, then ran the command brew update.
I did this to solve the problem
cd /usr/local
git pull origin master
What worked for me was to update the brew like this:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
On Big Sur 11.1 fixed it for me:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
Brew self described it as:
To brew update, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
What worked for me on Big Sur 11.4 was first following Pritam comment by executing the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
And then executing the following (what MoD said but with addition):
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow && git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
It took a while for both commands to finish, don't worry it's not you.... just let them run 😜
I have tried all solutions posted here but nothing had worked.
I have found solution to fix the problems retated to Homebrew and that is "brew doctor". This command option diagnose the problem and suggest the solution. For my case, the command showed following comment.
I guess this command would solve many problems related to home brew so try it out!
❯ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force
If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Alternatively, manually download them from:
https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 13.1.
I'm installing brew for the first time, and down to one error when I run brew doctor:
Warning: You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
cd /usr/local && git stash
If I cd to /usr/local and run "git status" I get:
On branch master
nothing to commit (working directory clean)
If I run: cd /usr/local && git stash, I get:
No local changes to save
Should I ignore this warning? I'm on OSX 10.8.
I had this same issue, none of the above suggestions got rid of the warning for me.
It appears that Homebrew will complain about un-committed/un-stashed changes even if they haven't been added to a commit, and if they haven't been added to a commit, git stash won't do anything.
So what i had to do is:
$ cd /usr/local
$ git add . # add the unsaved changes homebrew is complaining about
$ git stash # stash the changes, now that they're in a commit
$ brew update # update homebrew
$ brew doctor # running brew doctor now outputs 'raring to brew'
Or if you want, run everything at once:
cd /usr/local/Homebrew && git add . && git stash && git clean -d -f && brew update && brew doctor
I found the problem, researching a different problem. My computer had an older version of git installed (1.5.6.56.g29b0d). It was located at /usr/local/bin/git. I downloaded the latest version (1.7.11.3) which installed itself at /usr/local/git/bin/git. After tweaking my PATH to recognize the new git, I was able to get past the error above.
brew doctor
Warning: Your Homebrew is outdated
You haven't updated for at least 24 hours, this is a long time in brewland!
Then I was able to run brew update successfully:
brew update
Updated Homebrew from ed127082 to 4a36c56a.
...
And now it looks like I'm good to go:
brew doctor
Your system is raring to brew.