Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Brew cleanup unable to remove old python

Due to long travel, I did not get a chance to update or upgrade brew for a long time and now when I run brew update or brew cleanup I get the following message:

 $ brew cleanup
 Removing: /usr/local/Cellar/python/3.6.5... (3,196 files, 75MB)
 Error: Could not remove /usr/local/Cellar/python/3.6.5! Check its 
 permissions.

Is it safe to remove the 3.6.5 subdirectory from /usr/local/Cellar/python/3.6.5 as root and then do a brew cleanup again?

EDIT: Output of brew doctor

Your system is ready to brew.

Output of brew cleanup -vd

<Long output suppressed>   
==> This operation has freed approximately 75MB of disk space.
like image 292
leastaction Avatar asked Oct 15 '25 14:10

leastaction


1 Answers

For this particular error

Because homebrew is suggesting the problem could be a permission issue you can try to solve it by restoring the proper ownership on the Homebrew Cellar directory.

sudo chown -R your_user_name /usr/local/Cellar/

or a more general solution

sudo chown -R "$USER" "$(brew --prefix)/Cellar"

It worth to remember you can use brew doctor to check your system for potential problems. Usually, ignore the warnings if any.

like image 188
ePi272314 Avatar answered Oct 18 '25 01:10

ePi272314



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!