Mongodb install failing with Homebrew - SHA1 mismatch - macos

I am trying to install MongoDB on my Mac OSX 10.6.8. I am using the Homebrew method. Homebrew appears to be correctly installed - running brew update generates the message 'Already up-to-date'. But when I run brew install mongodb I get this message:
Error: SHA1 mismatch
Expected: 72152f9bec94aaaacb16d0b17511b0862d38ac21
Actual: 631676c22f98f9b7b87808130a4c1a99d7bf74b1
Archive: /Library/Caches/Homebrew/mongodb--patch-72152f9bec94aaaacb16d0b17511b0862d38ac21.patch
To retry an incomplete download, remove the file above.
If I remove that file, re-update brew, try to re-install mongodb, I get exactly the same result.
other action(s) taken - I ran sudo mv /opt/local ~/macports per instructions I was reading which I am not sure now where that came from, but it was that Homebrew and macports can interfere with each other.
If some understands what this problem is, and how to solve I would be grateful for the help.
When answering it would be wise to assume I am a newbie for this task.

Related

How to change Homebrew's prefix?

I'm using MACOS M1, and started to install brew under ARM. Then at the other day, I installed some formula under x86.
When I run a command
brew doctor
And I got this message
Some of Homebrew's bottles (binary packages) can only be used with the default
prefix (/usr/local).
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
unsupported configuration.
How to change the prefix to /usr/local/?
When I run which -a brew I got this result
/opt/homebrew/bin/brew
/usr/local/bin/brew
Thanks in advance.
I had the same issue because I did not installed the homebrew from the local path on my terminal.
I just uninstalled the homebrew, installed it again (from the local path this time) and it is fine now.
To uninstall Homebrew, run the uninstall script from the HomeBrew/install repository.

Homebrew Portable Ruby Error macOS 10.14.6

Homebrew suddenly stopped working, when i run any brew command i get following output:
==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
Already downloaded: /Users/<user>/Library/Caches/Homebrew/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
/usr/local/Homebrew/Library/Homebrew/cmd/vendor-install.sh: line 123: /usr/bin/cut: cannot execute binary file
Error: Checksum mismatch.
Expected: b065e5e3783954f3e65d8d3a6377ca51649bfcfa21b356b0dd70490f74c6bd86
Actual:
Archive: /Users/<user>/Library/Caches/Homebrew/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
To retry an incomplete download, remove the file above.
Error: Failed to upgrade Homebrew Portable Ruby!
I already tried to remove the file portable-ruby-2.6.3_2.yosemite.bottle.tar.gz but it doesn't work and i couldn't find any helpful information about this error on Google.
Any help is appreciated.
There are several things that I can think of for your situation.
Your output has yosemite identifier, to be clear, MacOS Yosemite is actually 10.10.x, it is not in the current/latest homebrew support list, and also different from 10.14 Mojave in your problem title. So if you are actually using Mojave, you can keep your brew up to date and reinstall ruby.
The latest Ruby formula is actually 2.7.x, you might want to reinstall/upgrade (brew reinstall ruby/brew upgrade ruby).
In all, if you still run into an issue, please attach the outputs of brew config and brew doctor for troubleshooting.
Try brew update-reset and then try brew upgrade.
It's set portable-ruby-2.6.3_2.yosemite.bottle.tar.gz was already downloaded so I removed it and it went through henceforth.

How to install Homebrew Portable Ruby when your system version is too old

I'm trying to install Homebrew on macOS. Once the installation finished, when I typed help I got:
Already downloaded: /.../Library/Caches/Homebrew/portable-ruby-2.6.3.mavericks.bottle.tar.gz
Error: Checksum mismatch.
Expected: ab81211a2052ccaa6d050741c433b728d0641523d8742eef23a5b450811e5104
Actual: f80fd4cc877a64b0ac1c105fdc212ca6be08bb034118900f2c2f58edcfe0dafd
Archive: /.../Library/Caches/Homebrew/portable-ruby-2.6.3.mavericks.bottle.tar.gz
To retry an incomplete download, remove the file above.
Error: Failed to install Homebrew Portable Ruby (and your system version is too old)!
I had the same question, and the solution is simple: remove the portable-ruby-2.6.3.mavericks.bottle.tar.gz you downloaded before.
rm /.../Library/Caches/Homebrew/portable-ruby-2.6.3.mavericks.bottle.tar.gz
Try running brew update-reset in your terminal and then run brew upgrade in the same terminal.
"Homebrew install fails with Error: Failed to install Homebrew Portable Ruby" helped me tremendously.
It would fail to install, because our company firewall was blocking certain downloads, like bottle, during the Homebrew update/install, but it was difficult to determine this because I would get the error above.
After removing the file, try
brew upgrade
brew update
on your personal Wifi or your phone's hotspot.
I fixed it.
First, I deleted the brew file that stores in the Library folder when using macOS.
The failure before was due to the connection. When I make sure the connection worked, it worked.
Remove the Homebrew Portable Ruby tar.gz from your Mac using:
rm <the path.tar.gz>
rm -rf <the path.tar.gz>
I've been automating this for years. There is a new something(?) in play during the Homebrew install.
I had the same error as above. I filed an issue report and got a response that fixed my problem:
CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
I'm not sure what prefixing with CI=1 does but all my automation issues went away.
To retry an incomplete download, remove the file above, then run:
rm /.../Library/Caches/Homebrew/portableruby-2.6.3.mavericks.bottle.tar.gz
and try again
my problem was:
Already downloaded: ../Library/Caches/Homebrew/portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz
==> Pouring portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz
Error: Failed to install ruby 2.6.8_1!
Error: Failed to install Homebrew Portable Ruby (and your system version is too old)!
Fixed with opening the system app for terminal and installing Rosetta into the prompt. This happened after system update MacOS to 11.6.7
After resolving this brew did brew upgrade finish well.
Hope this helps someone.
Here is how I fixed it:
brew cleanup then brew upgrade

Tex error occurred while upgrading octave with brew

I first installed octave through brew with the instruction on the office website. One day when I entered brew update && brew upgrade, octave started to upgrade but one error occurred said
You don't have a working TeX binary (tex) installed anywhere in your
PATH, and texi2dvi cannot proceed without one. If you want to use this
script, you'll need to install TeX (if you don't have it) or change
your PATH or TEX environment variable (if you do). See the --help
output for more details.
So I entered brew cask install mactex to install tex and added the Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin to the PATH, when I run tex, it correctly processed:
terminal screenshot
Then I run brew upgrade but the same error occurred again.
I realized that the --without-docs argument may fix this problem but if I want to install docs (since I have already installed tex) what should I do?
I had similar problem while installing another program (not octave) and after looking around I found that I needed to install TeTex (http://www.tug.org/teTeX/) or TexLive, however I decided to install TexLive because TeTex is not mantained anymore...
For me it worked after installing Texlive on the basic configuration. You can follow the instructions over here:
http://www.tug.org/texlive/quickinstall.html

OSX Homebrew error: uninitialized constant MACOS

I've searched around a bit and can't seem to find any record of anyone else with this problem.
Whenever I try to run
$ brew update
I am rewarded with
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
This isn't my machine and I normally develop on Linux systems so this is all a bit odd to me.
Any help would be greatly appreciated! Please tell me if there is any additional info I should provide. Again, I'm not used to homebrew or OSX.
EDIT
at the request of JameA
xiao:~ patrick$ brew doctor
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
xiao:~ patrick$ brew --config
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
...Not sure I like this whole "here, use this macbook for the project, it works better" thing...
I'm pretty sure the root cause of this is a failed upgrade attempt to Homebrew 0.9.5 from a much earlier version. Basically, if you run brew update as opposed to sudo brew update a portion of files are updated, while others are not. Here's what worked for me:
Edit /usr/local/bin/brew (it's just a Ruby file, not a compiled binary, so any text editor will do). You'll find a block like:
if MACOS and MACOS_VERSION < 10.5
abort <<-EOABORT.undent
Homebrew requires Leopard or higher. For Tiger support, see:
https://github.com/mistydemeo/tigerbrew
EOABORT
end
Comment this out. Even if you don't know Ruby, you can probably intuit what this is doing—it's checking to see if you have a current version of OSX. Assuming that you do in fact have this version, this sanity check isn't necessary. Brew is still broken, but at least now it will load far enough to give error messages.
Run sudo brew update, spoiler alert: it fails, but this time with a meaningful error message:
$ brew update
error: Your local changes to the following files would be overwritten by merge:
[giant list of files here]
Well, today I learned that brew update is just a wrapper for git pull because anyone who has worked with git knows that error message. We can fix this too.
Switch into the homebrew git repository with cd /usr/local and give the command git reset --hard FETCH_HEAD.
This piece found here.
Give the command sudo brew update. Homebrew should now update successfully and work properly!
Once the system is working again, you can actually kind of see why an error like this would have occurred. For one, usr/local/bin/brew has been completely rewriten and isn't even Ruby anymore, and most of its configuration has been moved into /usr/local/Library/brew.rb which no longer uses the constants MACOS or MACOS_VERSION constants, as they have been replaced by the more object oriented OS.mac and MacOS.version.
The MACOS constant is set in globals.rb. It seems like you may have a borked installation of Homebrew.
Check the output of brew doctor for any suggestions.
If that doesn't help please update with the results of brew --config.
If all else fails you may want to try re-installing Homebrew.
UPDATE:
Since this was a previous user's machine make sure your user is the owner of /usr/local and everything within. Fix it with sudo chown -R $USER /usr/local.
I had a similar issue, when I Killed an install mid-way with Ctrl-D.
Post that whenever I tried installing anything it gave the following error
uninitialized constant Homebrew::CLI::Parser::ARGV_WITHOUT_MONKEY_PATCHING
As a fix, I went to the directory I had where homebrew was installed, and reset the HEAD.
cd /usr/local/Homebrew
git status
git checkout .
And then it started working magically.
I had a similar error with a "borked" installation of brew. I removed the small 5 line block of code in the /usr/local/bin/brew script starting with the MACOS line. That did the trick to allow me to uninstall and eventually reinstall it.
In addition to Matt Korostoff's answer.
On point 3 (resetting the repo), for recent version of Homebrew, the repo is no longer /usr/local, do cd "$(brew --repo)" instead.

Resources