Like it is mentioned here https://docs.brew.sh/FAQ#how-do-i-uninstall-homebrew I typed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
but it doesn't seem to work...
就像这里提到的https://docs.brew.sh/FAQ#how-do-i-uninstall-homebrew我键入/bin/bash-c“$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)“但它似乎不起作用。。。
When I type afterwards which brew
it returns /usr/local/bin/brew
当我之后键入哪个brew时,它会返回/usr/local/bin/brew
and when I type again /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
当我再次键入/bin/bash-c“$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)“
It displays :
它显示:
/bin/bash: line 236: /opt/homebrew/bin/brew: No such file or directory
Failed to locate Homebrew!
So I don't know what to do to uninstall brew.
所以我不知道该怎么卸载brew。
My ultimate goal is to not getting this error when I try to install a brew package :
我的最终目标是在尝试安装brew包时不会出现此错误:
Error: Cannot install in Homebrew on ARM processor in Intel default
prefix (/usr/local)! Please create a new installation in /opt/homebrew
using one of the "Alternative Installs" from:
https://docs.brew.sh/Installation You can migrate your previously
installed formula list with: brew bundle dump
I now have a Mac with Apple Silicon but I used to have a Intel Mac.
我现在有一台苹果硅的Mac,但我以前有一台英特尔Mac。
EDIT 1 : I took a quick look at the uninstall.sh
script here https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh
第1版:我在这里快速查看了uninstall.sh脚本https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh
It seems that my problem is induced by my os installation because I did it from an Intel-based MacOS time machine backup. The problem is the uninstall.sh
script is programed to uninstall homebrew according to the current os. So this script can only uninstall the ARM homebrew that I need and can't uninstall the Intel homebrew I try to get rid of...
我的问题似乎是由我的操作系统安装引起的,因为我是从基于英特尔的MacOS时间机器备份中安装的。问题是uninstall.sh脚本被编程为根据当前操作系统卸载自制程序。所以这个脚本只能卸载我需要的ARM自制程序,而不能卸载我试图摆脱的英特尔自制程序。。。
Maybe I should try to just change the line of code that detect I have a ARM CPU to make the script think I have a Intel-based Mac but I don't know if it could bring chaos in my computer...
也许我应该试着改变检测我有ARM CPU的代码行,让脚本认为我有一台基于英特尔的Mac,但我不知道这是否会给我的电脑带来混乱。。。
I'm surprised there's not a lot of answers about this problem since I don't think I'm the only one to have switched from Intel-based Mac to ARM-based Mac with Time Machine.
我很惊讶这个问题没有太多答案,因为我不认为我是唯一一个使用Time Machine从基于英特尔的Mac切换到基于ARM的Mac的人。
EDIT 2 : I tried to uninstall Homebrew with a command of my own arch -x86_64 ./uninstall_brew.sh
(I have no idea if it's not DANGEROUS) but I don't know if it worked well...
第二版:我试着用自己的arch-x86_64命令卸载Homebrew/uninstall_brew.sh(我不知道它是否不危险),但我不知道是否运行良好。。。
Here is the output of the command :
以下是命令的输出:
user@MacBook-Pro % arch -x86_64 ./uninstall_brew.sh
Warning: This script will remove:
/Users/user/Library/Caches/Homebrew/
/usr/local/Caskroom/
/usr/local/Cellar/
/usr/local/bin/brew -> /usr/local/bin/brew
Are you sure you want to uninstall Homebrew? This will remove your installed packages! [y/N] y
==> Removing Homebrew installation...
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
/usr/local/share/info/dir: Permission denied
Warning: Failed to delete /usr/local/Caskroom
rm: /usr/local/Caskroom: Permission denied
Warning: Failed to delete /usr/local/Cellar
rm: /usr/local/Cellar: Permission denied
==> Removing empty directories...
Password:
==> /usr/bin/sudo /usr/bin/find /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/var /usr/local/Caskroom /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks -name .DS_Store -delete
==> /usr/bin/sudo /usr/bin/find /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/var /usr/local/Caskroom /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks -depth -type d -empty -exec rmdir {} ;
==> Homebrew uninstalled!
The following possible Homebrew files were not deleted:
/usr/local/.com.apple.installer.keep
/usr/local/Frameworks/
/usr/local/Homebrew/
/usr/local/bin/
/usr/local/etc/
/usr/local/git/
/usr/local/include/
/usr/local/lib/
/usr/local/man/
/usr/local/opt/
/usr/local/remotedesktop/
/usr/local/sbin/
/usr/local/share/
/usr/local/var/
You may wish to remove them yourself.
更多回答
The OP has a similar problem but the link given in the answer he validated is a 404 error. The given solution tells the answer I search is in the FAQ but I've looked carefully and I didn't find it.
OP也有类似的问题,但他验证的答案中给出的链接是404错误。给定的解决方案告诉我搜索的答案在常见问题解答中,但我仔细查看了一下,没有找到。
Do you have permission on those folders? Can you delete them manually?
你对那些文件夹有权限吗?你能手动删除它们吗?
I have admin rights but I'm a bit afraid to use them in case it could be dangerous for the computer.
我有管理权限,但我有点害怕使用它们,以防对计算机造成危险。
I mean to use admin rights with the uninstall.sh script in case it could uninstall important files.
我的意思是在uninstall.sh脚本中使用管理员权限,以防它可以卸载重要文件。
优秀答案推荐
Try running: PATH=/usr/local/bin:$PATH arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
尝试运行:PATH=/usr/local/bin:$PATH arch-x86_64/bin/bash-c“$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)“
Found the answer here: https://github.com/Homebrew/discussions/discussions/3437
在这里找到答案:https://github.com/Homebrew/discussions/discussions/3437
I encounter similar issue on my M1 MBP, and I found that changing the uninstall path in the script may work.
我在我的M1 MBP上遇到了类似的问题,我发现更改脚本中的卸载路径可能会奏效。
First, I download a local copy of the uninstalling script
首先,我下载卸载脚本的本地副本
curl -O https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh
Then run the script locally and set the path to /user/local
(which is the default path of homebrew on intel Mac)
然后在本地运行脚本,并将路径设置为/user/local(这是intel Mac上自制程序的默认路径)
/bin/bash uninstall.sh --path=/usr/local
but it completed with 2 warnings I'm not sure what they are
但它完成了两个警告我不确定它们是什么
Warning: Failed during: /usr/bin/sudo rmdir /usr/local
Warning: Homebrew partially uninstalled (but there were steps that failed)!
To finish uninstalling rerun this script with `sudo`.
The following possible Homebrew files were not deleted:
/usr/local/Cellar/
/usr/local/Frameworks/
/usr/local/Homebrew/
/usr/local/bin/
/usr/local/etc/
/usr/local/include/
/usr/local/lib/
/usr/local/opt/
/usr/local/sbin/
/usr/local/share/
/usr/local/texlive/
/usr/local/var/
You may wish to remove them yourself.
Either way, I delete those files manually.
不管怎样,我都会手动删除这些文件。
(This is my first time to answer something on stack overflow. Hope this help!)
(这是我第一次回答堆栈溢出的问题。希望能有所帮助!)
I faced the same problem.
The solution is just to remove your git configuration from your mac.
我也面临同样的问题。解决方案只是从你的mac上删除你的git配置。
Command: rm -rf ~/.gitconfig
命令:rm-rf~/.gitconfig
After executing the command try to install brew. Command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
执行命令后,尝试安装brew。命令:/bin/bash-c“$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)“
After installing homebrew install the brew git
command: brew install git
then configure your GitHub profile.
安装自制软件后,安装brew-git命令:brew-install-git,然后配置你的GitHub配置文件。
Thank you.
非常感谢。
A simple and easy fix for that would be just use arch -x86_64
infront of your uninstall command it should work fine.
一个简单易行的修复方法是在卸载命令之前使用arch-x86_64,它应该可以正常工作。
Looking at that uninstall.sh
, there's a spot where homebrew_prefix_default
gets set according to the processor type, and there's usage info that says:
看看uninstall.sh,有一个位置可以根据处理器类型设置homebrew_prefix_default,使用信息显示:
-p, --path=PATH Sets Homebrew prefix. Defaults to ${homebrew_prefix_default}.
So it sure looks like you can override the default location by passing the --path=...
option with the path that you want, namely the one that the script would've chosen for an Intel machine, i.e /usr/local
.
因此,看起来确实可以通过传递--path=来覆盖默认位置。。。选项,其中包含所需的路径,即脚本为英特尔计算机选择的路径,例如/usr/local。
更多回答
For M1 I needed to tweak it like this: PATH=/opt/homebrew:$PATH arch -arm64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
对于M1,我需要这样调整:PATH=/opt/homebrew:$PATH arch-arm64/bin/bash-c“$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)“
@Starsky's tweak worked for me. Just a thing to note, might have to go into the /opt/homebrew
folder and delete what the script wasn't able to delete. Had some folders left after the script ran
@Starsky的调整对我很有效。需要注意的是,可能需要进入/opt/homebrew文件夹,删除脚本无法删除的内容。脚本运行后还剩下一些文件夹
我是一名优秀的程序员,十分优秀!