I used to have Homebrew installed, but then at some point it broke, so I tried reinstalling it.
I tried running:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It gave:
-e:70: warning: Insecure world writable dir /usr/local in PATH, mode 040777
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 don't know why it says it is installed, running brew gives "zsh: command not found: brew")
So I tried running that:
zsh: command not found: brew
Then I tried running it without brew clean-up. Which executed. I re-ran:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It starts downloading and installing until it gets to this point:
Downloading and installing Homebrew...
remote: Counting objects: 226839, done.
remote: Compressing objects: 100% (59610/59610), done.
remote: Total 226839 (delta 165997), reused 226815 (delta 165979)
Receiving objects: 100% (226839/226839), 52.14 MiB | 135.00 KiB/s, done.
Resolving deltas: 100% (165997/165997), done.
From https://github.com/Homebrew/homebrew
* [new branch] master -> origin/master
warning: unable to access 'bin/.gitattributes': Permission denied
error: unable to create file bin/brew (Permission denied)
fatal: Could not reset index file to revision 'origin/master'.
Failed during: git reset --hard origin/master
Tried adding sudo:
sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Gives:
Don't run this as root!
I don't know where to go from here. Can someone help me?
Did you restart your terminal after installing zsh? brew is possibly not loaded for zshell. Also you need to add usr/local/ to your $path in .zshrc zsh configuration file should be in the in root ~/.zshrc
Related
Background:
macbook pro
chip: m1
os ver: 12.2.1 (21D62)
Problem
I previously had homebrew installed on this machine via curl [found on homebrew's homepage].
I was having issues installing pyenv and came across this guide.
Step 1 was somewhat successful:
pyenv got installed
I was able to add the exports and evals to my .zshrc file:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
I noticed the following after closing and reopening iterm2:
I was getting a pyenv command not found error coming from .zshrc
The brew command was also not found
I was still able to use the pyenv command, despite the initial error when opening a new terminal session.
Logs
My install logs (all commands taken from above link)
thleo ~ /Users/thleo > ~ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
Cloning into '/Users/thleo/.pyenv'...
remote: Enumerating objects: 21712, done.
remote: Counting objects: 100% (470/470), done.
remote: Compressing objects: 100% (346/346), done.
remote: Total 21712 (delta 336), reused 194 (delta 107), pack-reused 21242
Receiving objects: 100% (21712/21712), 4.37 MiB | 1.17 MiB/s, done.
Resolving deltas: 100% (14676/14676), done.
thleo ~ /Users/thleo > ~ cd ~/.pyenv && src/configure && make -C src
gcc -fno-common -c -o realpath.o realpath.c
gcc -dynamiclib -dynamic -undefined dynamic_lookup -o ../libexec/pyenv-realpath.dylib realpath.o
thleo ~ thleo/.pyenv - (master) > ~ arch
arm64
thleo ~ thleo/.pyenv - (master) > ~ which brew
/opt/homebrew/bin/brew
thleo ~ thleo/.pyenv - (master) > ~ brew --version
Homebrew 3.5.4
Homebrew/homebrew-core (git revision e2e2cd1d5f0; last commit 2022-07-07)
Homebrew/homebrew-cask (git revision 63bdf4e642; last commit 2022-07-07)
thleo ~ thleo/.pyenv - (master) > ~ vi ~/.zshrc
thleo ~ thleo/.pyenv - (master) > ~
Behavior after install:
On launching new session in terminal:
Last login: Fri Jul 8 16:18:29 on ttys005
/Users/thleo/.zshrc:61: command not found: pyenv
thleo ~ /Users/thleo > ~ brew
zsh: command not found: brew
thleo ~ /Users/thleo > ~ pyenv --version
pyenv 2.3.2-1-g207f33fc
Question(s):
why is brew not found? I can't seem to find folders related to homebrew anywhere on the machine [searched via finder]
why is there a command not found: pyenv error when I can clearly use the command?
I moved from Windows to macOS a few days ago. I want to install homebrew. I used the following command
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)
but I am getting an error of permission denied.
==> 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
==> Downloading and installing Homebrew...
/usr/local/Homebrew/.git/branches/: Permission denied
Failed during: git init -q
==> 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
error: could not lock config file .git/config: Permission denied
Failed during: git config --replace-all homebrew.analyticsmessage true
==> Next steps:
- Run `brew help` to get started
- Further documentation:
https://docs.brew.sh
I checked many other Stackoverflow answers and followed articles online but I am not getting any solution.
comptag:~ username$ brew install curl
-bash: /usr/local/bin/brew: No such file or directory
Please suggest me some solutions.
Use the official command given on the Homebrew website:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
I'm trying to install Homebrew on MacOS Catalina.
After running the command on their official webpage I'm getting the following error.
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (9/9), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.
Failed during: /usr/local/bin/brew update --force
I was having the same problem with the Mac M1 Big Sur.
The comment above was a big help.
Step 1:
sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Step 2:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then it failed.
Step 3:
cd /opt/homebrew/library/taps/homebrew
Step 4:
sudo rmdir homebrew-core
Step 5:
git clone https://github.com/Homebrew/homebrew-core /opt/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
I also logged into Github on the browser, not sure if that mattered.
I had the same problem. Thankfully, the above answer put me in the right track. I just had to made changes on step 3, 4, and 5.
Step 1
sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Step 2
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Step 3
/usr/local/Homebrew/Library/Taps/homebrew
Step 4
sudo rm -r homebrew-core
Step 5
git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
I'm having a problem re-installing homebrew. I am running Mavericks
It started with me trying to install express.js. Homebrew had been installed on my mac for quite some time, never had any trouble with it. I used sudo npm install -g express, but when I ran express --version, I got command not found. Eventually, I found a possible solution online, and just tried to reinstall npm with brew remove npm and brew install npm. Again, I ran into errors (Unfortunately, I didn't save the exact errors) I used brew doctor to try and figure it out, looked up a ton of tutorials and mucked around with homebrew, and I guess I broke something.
Now, I figure I should just try and reinstall homebrew.
I run the install command for homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It returns this 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
So, I run
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
This returns:
-bash: brew: command not found
I try running the install command again, and this time, it doesn't tell me homebrew is already installed.
So again, I run the install command for homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
And now I get this:
==> 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 /bin/chmod g+rwx /Library/Caches/Homebrew
Password:
==> Downloading and installing Homebrew...
remote: Counting objects: 136, done.
remote: Total 136 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (136/136), 10.37 MiB | 1.53 MiB/s, done.
Resolving deltas: 100% (44/44), done.
From https://github.com/Onomanatee/portfolio_Yuri_Legiest
* [new branch] master -> origin/master
HEAD is now at c253261 Commit4
==> Installation successful!
==> Next steps
Run brew doctor before you install anything
Run brew help to get started
Running brew doctor or brew help , however, results in
-bash: brew: command not found
I really don't know how to fix this. And why is the brew installer referring to a repository I used as a test for a little web project? (right above Installation succesful!)
How do I fix this path issue? I can't use brew command and I think I previously symlink to wrong location.
Master:~ shaunstanislaus$ ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
Press enter to continue
==> Downloading and Installing Homebrew...
remote: Counting objects: 82368, done.
remote: Compressing objects: 100% (39323/39323), done.
remote: Total 82368 (delta 56782), reused 65301 (delta 42220)
Receiving objects: 100% (82368/82368), 11.68 MiB | 1.59 MiB/s, done.
Resolving deltas: 100% (56782/56782), done.
From https://github.com/mxcl/homebrew
* [new branch] master -> origin/master
HEAD is now at 2ea1a0e smpeg: depends on gtk
==> Installation successful!
You should run `brew doctor' *before* you install anything.
Now type: brew help
Master:~ shaunstanislaus$ brew doctor
-bash: /usr/local/bin/brew: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
Master:~ shaunstanislaus$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/shaunstanislaus/Library/Application Support/GoodSync:/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/Users/shaunstanislaus/.ec2/bin:/Users/shaunstanislaus/.rvm/bin
/usr/local/bin/brew: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
Not everyone keeps the default system version of ruby. Many will rename this file and use the MacPorts ruby, or compile it by hand, in which case it may be in a different location.
I recommend changing this so that it will look for the ruby executable in a different location if it's not in the default.
Visit http://linguisticlogic.wordpress.com/2010/11/27/homebrew-mac-osx-and-ruby/
just doing
sudo ln -s /opt/local/bin/ruby /usr/bin/ruby
may work !!!