Homebrew Installed But Also Not Installed - ruby

When I tried to install homebrew I got this error. It started simple but then I was perplexed.
cjbrigna$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /usr/bin/chgrp admin /Library/Caches/Homebrew
Password:
==> Downloading and installing Homebrew...
fatal: unable to access 'https://github.com/Homebrew/homebrew/': Could not resolve host: github.com
Failed during: git fetch origin master:refs/remotes/origin/master -n --depth=1
No problem, github was down for a little while. So I tried again later.
cjbrigna$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Which makes me think I have homebrew.
cjbrigna$ brew help
-sh: brew: command not found
Well clearly I didn't have homebrew.
cjbrigna$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Failed to locate Homebrew!
Well now I can't install or uninstall homebrew. This makes no sense. What did I do wrong? I appreciate any help.

You can finish the install process manually:
cd /usr/local
git fetch origin master:refs/remotes/origin/master -n --depth=1
git reset --hard origin/master
Then ensure /usr/local/bin is in your PATH. If it is you should then be able to run e.g. brew help to check that Homebrew is installed.

Related

Homebrew installation error: "not a valid ref: refs/remotes/origin/master"?

I have tried to install Homebrew on macOS Monterey by following the instructions at https://brew.sh/.
But it resulted in:
error: Not a valid ref: refs/remotes/origin/master
Error: Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-core failed!
fatal: invalid upstream 'origin/master'
Failed during: /opt/homebrew/bin/brew update --force --quiet
I encountered this error on my brand new Macbook Pro with the M2 processor. What worked for me was removing the contents of the homebrew directory
rm -rf /opt/homebrew
Then running the uninstall script (its the same as the intall script on the homebrew except change the last part from install to uninstall. Assuming the link has not changed on the homebrew website I ran these two commands and it installed successfully.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
You can run brew -v or brew doctor to check if your install is good.
My error was after a failed previous install with WSL... so same on windows, only:
cd /home
sudo rm -rf homebrew/
This worked on M1.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
git config --global core.compression 0
git config --global http.postBuffer 1048576000
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Brew installation - not a valid reference error

I am trying to install homebrew on macos m1 chip, with the one-line command but keep running into the following error. Could someone please help me to fix this? Thank you.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
Press RETURN to continue or any other key to abort:
==> /usr/bin/sudo /usr/sbin/chown -R miththinda:admin /opt/homebrew
==> Downloading and installing Homebrew...
HEAD is now at a0ae4a7a0 Merge pull request #12658 from sjackman/sj/linkage-checker
error: Not a valid ref: refs/remotes/origin/master
fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Removing the directory and trying to reinstall worked for me.
sudo rm -rf /opt/homebrew
Please run the following commands in your terminal:
rm -fr $(brew --repo homebrew/core) # because you can't `brew untap homebrew/core`
brew tap homebrew/core
You can check the details of the issue here.
Had a similar issue on Mac, I uninstalled it first by typing the command below and I installed Xcode, it worked for me after running the install command again.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
I first installed it onto my Linux system using the command recommended on the homebrew install page:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
but it seem to take a long time, and "hung" showing the output:
Resolving deltas: 100% (793706/793706), done.
for quite a while. I was impatient and killed the process then, and tried the install again. That is when I got the error reported by the OP. The fix was to uninstall the partially installed homebrew, and install again:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

How to uninstall Homebrew cleanly?

I tried
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
But I got errors
It appears Homebrew is already installed. If your intent is to reinstall you should do the following before running this installer again:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
The current contents of /usr/local are bin Cellar CONTRIBUTING.md etc Frameworks heroku Homebrew include lib n opt README README.md sbin share SUPPORTERS.md var .gitignore
So I tried
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Failed to locate Homebrew!
So I tried
rm -rf /usr/bin/.git and chown username /usr/local
But still the same.
How can I fix this issue. I need to have a fresh start.
My final purpose is to update current ruby2.0 to 2.2
Consider reading the Homebrew FAQ.
Scroll down the 4th FAQ listing enumerating :
How do I uninstall Homebrew ?
Alternatively, try running this and then run the uninstall procedure as mentioned above -
cd /usr/local
git init
git remote add origin https://github.com/Homebrew/homebrew
git pull origin master

Mac - Can’t install Homebrew

I tried to install Homebrew like this:
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
It didn’t install correctly so I closed Terminal and tried again. Now it displays me the following message:
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
I tried to do that but without success. The following message is displayed:
brew: command not found
So, the problem is that Homebrew is installed but actually it is not installed. Any suggestions how to solve this problem? Thank you!
This seems to have resolved the issue for me
rm -rf /usr/local/Cellar /usr/local/.git
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Afterward, I can now
brew doctor
You may also find the gist linked to at the following page of use:
https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md
The URL contained in the command you are using is not correct. Ruby will dump out lines of HTML and then fail. Use this command instead:
ruby -e "$(curl -fsSkL raw.github.com/Homebrew/homebrew/go/install)"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
this is work for me!
This worked for me:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
I removed the folder /usr/local/.git and homebrew installed just fine afterwards.
What was the message given when it didn't install correctly the first time? Is the brew binary present in /usr/local/bin ? If so, you probably just need to add it to your path, see: Error Installing Homebrew - Brew Command Not Found
Attempting to resolve the same issue, I found out that I had mistyped while making changes to my PATH. I did not have /usr/local/bin. I would then recommend running
$ echo $PATH
in terminal to see if you have the correct directories.You can also run
$ vi ~/.bash_profile
to see it and make changes if neccessary
If you cannot install by using curl try to open the install script from your browser, save it in a file called i.e brew_install.rb somewhere on your disk and run the script locally
ruby brew_install.rb
This worked for me.
Follow these steps
1 ==> ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
2 ==> sudo rm -rf /usr/local/Homebrew/
sudo rm -rf /usr/bin/Homebrew/
3 ==> install brew
1 -- /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2 -- sudo chown -R $(whoami) /usr/local/var/homebrew
If get these error try below command
Error: Failed to link all completions, docs and manpages:
sudo chown -R $(whoami) /usr/local/*
then follow these commands
/usr/local/bin/brew update --force
This is the most recent one that works for me.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
I found it here in case it is updated later. https://brew.sh/

how to install brew or homebrew on mac os 10.6

I have tried multiple times. Can anybody tell me exact detailed steps?
My mac os is 10.6.8.
It complains about some missing packages.
Use this to install on Mac OSX 10.6.8
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Open terminal (shortcut : Press cmd + space and enter terminal in spotlight search)
Enter command /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Now you’ll be asked to enter password (note : passwords are not visible)
If you get permission error as below
fatal: cannot copy '/Library/Developer/CommandLineTools/usr/share/git-core/templates/hooks/pre-receive.sample' to '/usr/local/Homebrew/.git/hooks/pre-receive.sample': Permission denied
Failed during: git init -q
Enter command sudo chown -R $(whoami) $(brew --prefix)/*
Now you’ll be asked to enter password
Again enter the same command written in step 2 (shortcut : simply press top arrow button)
Wait patiently for sometime. You’ll see installation successful after a while.
Thereafter if you need any help regarding brew then simply enter brew help command. Refer this link for additional details.
brew.sh (the official home page) always has the most up-to-date installation instructions.
I got it working now following command /usr/bin/ruby -e "$(curl -fsSL raw.github.com/gist/323731)".
I was running the mkdir homebrew && curl -L github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C homebrew I have no idea what the two are doing though
This are my results on OSX 1068:
ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin10.0]
brew -v
Homebrew 1.3.4
Homebrew/homebrew-core (git revision 897df; last commit 2017-10-06)
And after:
brew update
brew -v
Homebrew 1.3.5
Homebrew/homebrew-core (git revision 713fe; last commit 2017-10-15)
npm -v
5.4.2
and doing:
sudo npm install npm#latest -g
sudo npm i -g npm
npm -v
5.5.1
node -v
v6.9.5
And after:
brew upgrade node

Resources