How to clean up an interrupted Homebrew install? - homebrew

I recently decided to brew install stack, the Haskell package manager, but changed my mind midway and interrupted with ctrl+c. It looks like a reasonable amount of storage has been taken up on my computer by the install, however, so I think the downloaded files from the installation remain. How can I clean them out?
I've already tried brew cleanup but it only cleared a few things, maybe 20 mb in total. Is there a way to completely remove the remains of an interrupted Homebrew install? If not, any tips for going about it?
Thanks!

Have you tired brew doctor ? It usually gives a good idea of what might be going wrong. I would then suggest looking into the Cellar folder and search for leftovers.

Run the command
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
There will be files that will not be deleted, delete them manually. Deleting this worked for me /usr/local/Homebrew/

Related

Possibly corrupt gluon download - message "graalvm-svm-java11-darwin-m1-gluon-22.1.0.1-Final” is damaged and can’t be opened

This might just be me doing something stupid but I'm getting a popup message on running java --version when I use the install: graalvm-svm-java11-darwin-m1-gluon-22.1.0.1-Final
"graalvm-svm-java11-darwin-m1-gluon-22.1.0.1-Final” is damaged and can’t be opened
Does anyone else have the same issue? I've switched to my Pentium MacMini, so it's not urgent; but I do need Java11 and not 17 due to a dependency issue.
The following versions all run correctly and were installed using the same procedure and I have set the necessary quarantine paths.
graalvm-ce-java11-22.3.1
graalvm-svm-java11-darwin-gluon-22.1.0.1-Final
graalvm-svm-java17-darwin-gluon-22.1.0.1-Final
openjdk11-openj9
graalvm-svm-java17-darwin-m1-gluon-22.1.0.1-Final
So it's only the ...-java11-...-m1...tar that gives the message.
I looked for an older m1 release, but 22.1.0.1 was the only one I could see.
The GraalVM build graalvm-svm-java11-darwin-m1-gluon-22.1.0.1-Final downloaded from https://github.com/gluonhq/graal/releases works just fine.
When you use the GluonFX plugin, the first time you run mvn gluonfx:build you get prompted to add a password, just to remove the quarantine from it.
But if you want to run anything like /path/to/graalvm/bin/java -version before that, the folder is still under quarantine, that won't work, and you will get the error that you posted:
"graalvm-svm-java11-darwin-m1-gluon-22.1.0.1-Final” is damaged and can’t be opened
You just need to remove the quarantine yourself, running:
sudo xattr -r -d com.apple.quarantine /path/to/graalvm
See the open issue https://github.com/oracle/graal/issues/1724 for reference.

Two 'Homebrew' on my mac; one in opt and one in local. How do I delete one?

I bought a new Mac Studio to replace my old (2013) Mac Pro. I used Homebrew for programming for school; I'm over 75 but I'm going to school (ece) for fun. Thinking it would be a good idea to install a Homebrew for the Apple chipset, I installed Homebrew. But instead of overwriting my old version, it installed a new version in /opt . The old was in /usr/local/bin . How do I delete the old install? Somehow I think having two 'brew's is not a god idea.
I've tried nothing so far. I don't think rmdir -pv on /usr/local/bin/brew would be sufficient. Especially as I don't know where Homebrew store everything and I might end up deleting something I need and don't know I need it.
The Homebrew installation under /usr/local is for Intel and the installation under /opt/homebrew is for M1.
If you want to remove the Intel installation, you can download the official uninstall script. Make it executable with:
chmod +x uninstall.sh
and run it on the Intel installation with:
./uninstall.sh --path=/usr/local

Cannot install asdf erlang on MAC OSX Mojave

I am trying to install Erlang in a Mac OS system with Mojave on it. However the installation hangs for no apparent reason:
$ asdf install erlang 22.2.8
asdf_22.2.8 is not a kerl-managed Erlang/OTP installation
The asdf_22.2.8 build has been deleted
Extracting source code
Building Erlang/OTP 22.2.8 (asdf_22.2.8), please wait...
I know the issue is not the network, as I have downloaded everything and the step that hangs forever is the Building step.
I have removed and re-installed both asdf and Erlang from scratch as well, but it didn't fix the issue.
I believe I have all necessary dependencies as well, otherwise the re-installation would have failed.
What can I do to fix this?
Go to ~/.asdf/plugins/erlang/kerl-home/builds/asdf_22.2.8 and look at the otp_build_22.2.8.log file. It should tell you what's going on.
Solution
Thanks to the post by #legoscia I went to ~/.asdf/plugins/erlang/kerl-home/builds/asdf_22.2.8 and looked at the otp_build_22.2.8.log while it was still being built.
By checking this I was actually able to find out that I had a problem with my brew installation, which in turn meant I was using a very outdated version of XCode and XTools.
By forcing an upgrade on my machine (and as a consequence fixing my broken brew installation), I was then able to smoothly run and install asdf install erlang.
I know this is the solution, but I will give credit to #legoscia, as without him/her I would not have been able to fix my issue.

Is it safe to force remove /usr/local/lib/docker to fix a Homebrew permission issue?

I'm trying to cleanup my installed packages using brew cleanup but keep getting the message Permission denied # apply2files - /usr/local/lib/docker/cli-plugins.
I tried changing the ownership of /usr/local/lib/docker/cli-plugins using sudo chown $(whoami) /usr/local/lib/docker/cli-plugins then ran brew cleanup again but this got the same result.
It might be worth noting that I do not use the Docker application anymore and don't even have it installed anymore. So I was wondering if simply force removing the /docker directory using the rm -rf /usr/local/lib/docker/ command would help? Or would that do more harm than good?
I don't think there would be any issue of deleting or reinstalling /usr/local/lib/docker/. You should be always re-installing the right Docker app and brew link it for the use.
But before you are doing that, I'd recommend you to run brew doctor first.

Homebrew - repeated "linking" bug. What is the underlying issue here?

So I've been using homebrew to install various packages/libraries/programs on my mac. I keep running into a problem in which homebrew tells me that I have unlinked kegs in my Cellar.
For instance, upon running brew install phantomjs I received the following message:
Warning: Could not link phantomjs. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link phantomjs'
Possible conflicting files are:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs
I tried running brew link phantomjs as recommended, and hit a similar problem:
Error: Could not symlink file: /usr/local/Cellar/phantomjs/1.9.2/bin/phantomjs
Target /usr/local/bin/phantomjs already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
brew link --overwrite formula_name
The command brew link --overwrite --dry-run phantomjs gives the following message:
Would remove:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs
I will probably go ahead and overwrite, but this appears to happen every time I try to install something with homebrew. Why? Why isn't homebrew working as expected?
Thanks.
From what I can tell, looks like you have previously done:
% sudo npm install -g phantomjs
In this case, you should do the following:
% sudo npm uninstall -g phantomjs
% brew link --overwrite phantomjs
I thought I'd take a crack at this. I ran into a similar problem today, and I think it may be related to this:
https://github.com/Homebrew/homebrew/issues/22408
Long story short, I think it has to do with how npm manages packages vs how brew does it. (I'm assuming you installed node with its defaults, which would have given you npm).
At some point you probably installed some package with npm. Maybe grunt, karma, etc..those by default end up in /usr/local/lib/node_modules.
Maybe one of those packages or its dependencies(or sub-dependencies) depended on phantomjs (I think Karma might use phantomjs?) Anyways, if now you are trying to brew install phantomjs, which is trying to make a symlink to it, that may be conflicting with the already existing symlink that npm created for you..
I think you can change the symlink path for that package so that brew permanently points to that already installed package in the node_modules folder. Sorry not to be more specific, I'm just figuring this out myself.

Resources