brew cannot find ANY packages - macos

I just got my Mac Pro from the shop after hard drive failure. I am trying to install my environment again.
I installed homebrew from the current link on the homebrew website:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
but I cannot install ANY package. Brew cannot find ANYTHING.
~ brew install rbenv
Error: No available formula with the name "rbenv"
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
What is wrong?

I had the same issue and I was able to solve it by running the doctor command and follow the steps which need to be updated there.
My homebrew-core was not at the master branch.
brew doctor
git -C $(brew --repo homebrew/core) checkout master
And that's it. After that, I was able to run the rbenv install command.

brew search result
$ brew search rbenv
==> Formulae
rbenv rbenv-bundle-exec rbenv-chefdk rbenv-default-gems rbenv-vars
rbenv-aliases rbenv-bundler rbenv-communal-gems rbenv-gemset rbenv-whatis
rbenv-binstubs rbenv-bundler-ruby-version rbenv-ctags rbenv-use
install rbenv
$ brew install rbenv
==> Downloading https://github.com/rbenv/ruby-build/archive/v20200819.tar.gz
==> Downloading from https://codeload.github.com/rbenv/ruby-build/tar.gz/v20200819
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/rbenv-1.1.2.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Installing dependencies for rbenv: ruby-build
==> Installing rbenv dependency: ruby-build
==> ./install.sh
==> Caveats
ruby-build installs a non-Homebrew OpenSSL for each Ruby version installed and these are never upgraded.
To link Rubies to Homebrew's OpenSSL 1.1 (which is upgraded) add the following
to your /Users/rchen/.bash_profile:
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl#1.1)"
Note: this may interfere with building old versions of Ruby (e.g <2.4) that use
OpenSSL <1.1.
==> Summary
🍺 /usr/local/Cellar/ruby-build/20200819: 509 files, 253.6KB, built in 5 seconds
==> Installing rbenv
==> Pouring rbenv-1.1.2.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/rbenv/1.1.2: 36 files, 65KB
==> Caveats
==> ruby-build
ruby-build installs a non-Homebrew OpenSSL for each Ruby version installed and these are never upgraded.
To link Rubies to Homebrew's OpenSSL 1.1 (which is upgraded) add the following
to your /Users/rchen/.bash_profile:
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl#1.1)"
Note: this may interfere with building old versions of Ruby (e.g <2.4) that use
OpenSSL <1.1.
version test
$ rbenv --version
rbenv 1.1.2

Related

How to configure rbenv with ruby?

I've tried to install ruby on my mac. Ruby is already installed :
brew install ruby
Running `brew update --preinstall`...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
ghcup reshape tidy-viewer vermin
==> Updated Formulae
Updated 159 formulae.
==> New Casks
kindavim music-bar presentation
==> Updated Casks
Updated 143 casks.
==> Deleted Casks
airqmon
Warning: ruby 3.0.3 is already installed and up-to-date.
To reinstall 3.0.3, run:
brew reinstall ruby
But when i run ruby -version, i get the following result :
/Users/oscar/.rbenv/shims/ruby: line 21: /usr/local/Cellar/rbenv/0.4.0/libexec/rbenv: No such file or directory
I am using rbenv. I've tried to reinstall rbenv but i get the same error.
I am new in ruby and i need some help please.
How to solve this error ?
Thanks
You installed Ruby previously with rbenv and now you show that you installed Ruby with brew, which is a totally different process. I assume you removed your rbenv installation, but left around some leftovers. If you wish to continue with your brew Ruby installation, which is in my opinion perfectly good, you just need to remove the rbenv leftovers by removing your /Users/oscar/.rbenv directory, possibly you may also need to restart your Terminal.

Why can't I install openssl on my Mac by homebrew?

I run the following code, which show that there are no openssl repo find in brew.
My Mac is macOS Big Sur 11.3.1
% brew install openssl
Updating Homebrew...
fatal: Could not resolve HEAD to a revision
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 1 cask.
Warning: No available formula or cask with the name "openssl".
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
This formula was found in a tap:
homebrew/portable-ruby/portable-openssl
To install it, run:
brew install homebrew/portable-ruby/portable-openssl
UPDATE
Seems that my brew can't install ccache either like the following. It is more of a brew issue?
brew install ccache
try this put it in terminal and run:
brew uninstall openssl; brew uninstall openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
The following commands help
cd /usr/local/Homebrew/Library/Taps/homebrew/
rm -rf homebrew-core
git clone https://github.com/Homebrew/homebrew-core.git
try this:
git -C $(brew --repo homebrew/core) checkout master
^This should be the fix anytime you see the error "Could not resolve HEAD to a revision, as you may find at the bottom of the output when running "brew doctor"

Can't install emacs in Homebrew

$ brew install emacs
Updating Homebrew...
Warning: Treating emacs as a formula. For the cask, use homebrew/cask/emacs
==> Downloading https://homebrew.bintray.com/bottles/emacs-27.1.mojave.bottle.1.tar.gz
Already downloaded: /Users/xxx/Library/Caches/Homebrew/downloads/edc19e2cbf4d5136f0e31adfb9c57161b65dd8163f861a92e10bfd617d1d611c--emacs-27.1.mojave.bottle.1.tar.gz
==> Pouring emacs-27.1.mojave.bottle.1.tar.gz
==> emacs cask is installed, skipping link.
==> Caveats
To have launchd start emacs now and restart at login:
brew services start emacs
Or, if you don't want/need a background service you can just run:
emacs
==> Summary
🍺 /usr/local/Cellar/emacs/27.1: 4,009 files, 104.0MB
==> Upgrading 1 dependent:
cask 0.8.4 -> 0.8.5
==> Upgrading cask 0.8.4 -> 0.8.5
==> Downloading https://github.com/cask/cask/archive/v0.8.5.tar.gz
==> Downloading from https://codeload.github.com/cask/cask/tar.gz/v0.8.5
######################################################################## 100.0%
Error: An exception occurred within a child process:
RuntimeError: /usr/local/opt/emacs not present or broken
Please reinstall emacs. Sorry :(
How to fix this?
By looking at the output, it seems emacs actually got installed:
==> Summary
🍺 /usr/local/Cellar/emacs/27.1: 4,009 files, 104.0MB
You should be able to use it straight away.
If you prefer a GUI version, you can install it with:
brew install --cask emacs
The problem
Error: An exception occurred within a child process:
RuntimeError: /usr/local/opt/emacs not present or broken
Please reinstall emacs. Sorry :(
It's another tool, cask, which fails to install:
It cannot find the emacs dir under /usr/local/opt/emacs.
Homebrew installed it at /usr/local/Cellar/emacs/27.1.
The fix
You can fix it by:
(Recommended) Creating a symlink in /usr/local/opt/ to emacs directory
$ brew link --overwrite emacs # if it complains about relinking, run brew unlink emacs && brew link emacs instead
$ brew install cask
(Alternative) If the previous point didn't help, ignoring dependencies while installing cask
$ brew install cask --ignore-dependencies
Please let me know if it helped

SSL Error installing rbenv on Mac Catalina

I'm trying to install rbenv on Mac Catalina Version 10.15.7 using homebrew and I get this error:
gaston.ramos#AR-IT10128 ~ % brew install rbenv
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 4 formulae.
==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.catalina.bottle.4.tar.gz
Already downloaded: /Users/gaston.ramos/Library/Caches/Homebrew/downloads/c473cc5dd3e84f64b99973078d9d9caae87e7810e6e771008e63d651bbe8007f--autoconf-2.69.catalina.bottle.4.tar.gz
==> Downloading https://github.com/rbenv/ruby-build/archive/v20201221.tar.gz
##O#- #
curl: (35) error:1400410B:SSL routines:CONNECT_CR_SRVR_HELLO:wrong version number
Error: Failed to download resource "ruby-build"
Download failed: https://github.com/rbenv/ruby-build/archive/v20201221.tar.gz
Any idea on how to solve this? It seems that there is an SSL error when brew tries to download ruby-build
Thanks.
Use a different mirror
foo#bar$ env HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles brew install rbenv

Ruby Version Failure 2.7.0: Error: Permission denied # apply2files - /usr/local/share/Library/

As the title states, when I try install Ruby version 2.7.0 with rvm install ruby-2.7.0, I get the following output:
Ruby Version Failure 2.7.0: Error: Permission denied # apply2files - /usr/local/share/Library/Caches/Yarn/v6/npm-micromatch-3.1.10-70859bc95c9840952f359a068a3fc49f9ecfac23-integrity/node_modules/micromatch/lib/.DS_Stor
The full output is below:
==> Upgrading 3 outdated packages:
libtool 2.4.6_1 -> 2.4.6_2
libyaml 0.2.2 -> 0.2.5
pkg-config 0.29.2_2 -> 0.29.2_3
==> Upgrading libtool 2.4.6_1 -> 2.4.6_2
==> Downloading https://homebrew.bintray.com/bottles/libtool-2.4.6_2.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/af317b35d0a394b7ef55fba4950735b0392d9f31bececebf9c412261c23a01fc?response-content-disposition=attachment%3Bfilename%3D%22libtool-2.4.6_2.catalina.b
######################################################################## 100.0%
==> Pouring libtool-2.4.6_2.catalina.bottle.tar.gz
==> Caveats
In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.
==> Summary
🍺 /usr/local/Cellar/libtool/2.4.6_2: 71 files, 3.7MB
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /usr/local/Cellar/libtool/2.4.6_1... (71 files, 3.7MB)
Error: Permission denied # apply2files - /usr/local/share/Library/Caches/Yarn/v6/npm-micromatch-3.1.10-70859bc95c9840952f359a068a3fc49f9ecfac23-integrity/node_modules/micromatch/lib/.DS_Store
This is unrelated to rvm itself. To install required dependencies for your ruby, rvm used your installed homebrew. However, during cleanup of your installed bottles, homebrew encounters an error, possible because you one installed things with sudo previously.
Try brew doctor and follow its advice to fix your homebrew setup.

Resources