Java Homebrew installation - ruby

I am trying to install Homebrew on my Mac, for use with Java development. I have followed the instructions at: https://brew.sh, and pasted the command: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" into my terminal.
When I do this, a few scripts are executed, and I get the output:
MacBook-Pro:~ me$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /Library/Caches/Homebrew
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown me /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
HEAD is now at ea8be17 Merge pull request #2631 from GauthamGoli/audit_homepage_rubocop
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/me/Library/Caches/Homeb
==> Deleting /Library/Caches/Homebrew...
Already up-to-date.
Error: Could not link:
/usr/local/etc/bash_completion.d/brew
Please delete these paths and run brew update.
Error: Failed to link all completions, docs and manpages:
Permission denied - (../../../Homebrew/completions/zsh/_brew_cask, /usr/local/share/zsh/site-functions/_brew_cask)
Failed during: /usr/local/bin/brew update --force
MacBook-Pro:~ me$
So the output is telling me that it's already up-to-date, presumably because I've already tried installing it once or twice?
How can I delete the paths to run brew update, like it's telling me to?

I encountered this error. The fix is to run the command sudo chown -R $USER:admin /usr/local/* as described on the Tech Stacker blog post that solves this issue.

Related

Homebrew incompatible architecture error on M1 MacBook

I am getting below error while running /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" on my new M1 MacBook pro 16.
kevin#MacBook-Pro ~ % /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/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /usr/sbin/chown -R kevin:admin /opt/homebrew
==> Downloading and installing Homebrew...
xcrun: error: unable to load libxcrun (dlopen(/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib, 0x0005): tried: '/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))).
Failed during: git init -q
kevin#MacBook-Pro ~ %
This is my first time setting up development on macOS so please do let me know if I am missing something here.
Deleting /Library/Developer/CommandLineTools with sudo rm -rf /Library/Developer/CommandLineToolsand running /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/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)"

Installing brew on macOS Catalina

I've encountered a problem while installing brew on my machine. The installation is a success till it creates a Homebrew directory in ~/local.
I've executed the following:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Result
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following new directories will be created:
/usr/local/bin
/usr/local/Homebrew
==> The Xcode Command Line Tools will be installed.
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /usr/local/bin /usr/local/Homebrew
mkdir: /usr/local/bin: Not a directory
Failed during: /usr/bin/sudo /bin/mkdir -p /usr/local/bin /usr/local/Homebrew
I've tried installing using superuser mode and the system does not allow to use the superuser mode to install files from internet source.
TIA

Homebrew failing to install - fatal: not in a git directory

I'm trying to install homebrew on a macOS and I'm failing with the following message:
h
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics data has been sent yet (or will be during this `install` run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
fatal: not in a git directory
Failed during: git config --replace-all homebrew.analyticsmessage true
Any ideas of what it could be and how to fix it? Many thanks (:
sudo rm -rf /usr/local/Homebrew
to remove everything before you landed here ;) and then run
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
I hope it helps.
Can you run the following commands to see if it helps?
$ cd `brew --prefix`
$ git remote add origin https://github.com/Homebrew/homebrew.git
$ git fetch origin
$ git reset --hard origin/master
$ brew update
Already up-to-date.
Also it would be helpful if you can attach brew doctor and brew config in the original post. Thanks!
I had a similar problem, running this command; "/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
I got this log;
=> /usr/bin/sudo /bin/chmod u+rwx /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> Downloading and installing Homebrew...
/usr/local/homebrew/.git: Permission denied
I gave permission to /user/local/homebrew and now I can test with brew....

Homebrew Installed But Also Not Installed

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.

Resources