mac-cleanup-py icon indicating copy to clipboard operation
mac-cleanup-py copied to clipboard

Stuck on "Cleaning up DNS cache"

Open 0xCarnival opened this issue 1 year ago • 22 comments

It stuck on "Cleaning up DNS cache"

After running "mac-cleanup" from the terminal, it first cleans "homebrew", and then it stucks on "Cleaning up DNS cache". Uploading Screenshot 2024-08-09 at 4.02.15 PM.png…

0xCarnival avatar Aug 09 '24 09:08 0xCarnival

👋🏻 Thank you for your feedback, gonna watch it soon

github-actions[bot] avatar Aug 09 '24 09:08 github-actions[bot]

Hey 👋🏻 Can you specify the version it occurred to you in?

efa2d19 avatar Aug 09 '24 09:08 efa2d19

Hey 👋🏻 Can you specify the version it occurred to you in?

I reinstalled it, so I believe it is the latest version.

0xCarnival avatar Aug 09 '24 09:08 0xCarnival

DNS cleaning doesn't work in script:

I can support @0xCarnival's problem, for me also it is stuck at DNS cleaning. I used the commands of the script manually and they are working without issue, something is not letting the python code move on..

Workaround:

  1. Finder -> "Go to Folder.." open following path: "/opt/homebrew/Cellar/mac-cleanup-py/3.0.4/libexec/lib/python3.10/site-packages/mac_cleanup"
  2. Go into the file "default_modules.py"
  3. Go to line 409
  4. Comment out lines 412 and 413: unit.add(Command("sudo dscacheutil -flushcache")) unit.add(Command("sudo killall -HUP mDNSResponder"))

Just add a # in front of those two lines.

I know the script is not cleaning the DNS-Cache now but it executes fine after that.

liebki avatar Aug 13 '24 08:08 liebki

Thanks for the suggestion. I tried doing this and it didn't work.

Just to make sure, you are suggesting this quick fix for now:

def dns_cache(): with clc as unit: unit.message("Cleaning up DNS cache") #unit.add(Command("sudo dscacheutil -flushcache")) #unit.add(Command("sudo killall -HUP mDNSResponder"))

It stucks on:

⠋ Cleaning up DNS cache ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:-- 0:00:00⠴ Cleaning up DNS cache ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:-- 0:02:03

On Tue, Aug 13, 2024 at 3:25 PM Kim @.***> wrote:

DNS cleaning doesn't work in script:

I can support @0xCarnival https://github.com/0xCarnival's problem, for me also it is stuck at DNS cleaning. I used the commands of the script manually and they are working without issue, something is not letting the python code move on.. Workaround:

  1. Finder -> "Go to Folder.." open following path:

"/opt/homebrew/Cellar/mac-cleanup-py/3.0.4/libexec/lib/python3.10/site-packages/mac_cleanup" 2. Go into the file "default_modules.py" 3. Go to line 409 4. Comment out lines 412 and 413: unit.add(Command("sudo dscacheutil -flushcache")) unit.add(Command("sudo killall -HUP mDNSResponder"))

Just add a # in front of those two lines.

I know the script is not cleaning the DNS-Cache now but it executes fine after that.

— Reply to this email directly, view it on GitHub https://github.com/mac-cleanup/mac-cleanup-py/issues/192#issuecomment-2285660337, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWRC6DZQQ3SDUTPJZ4PFOODZRG7JJAVCNFSM6AAAAABMIB5MMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBVGY3DAMZTG4 . You are receiving this because you were mentioned.Message ID: @.***>

0xCarnival avatar Aug 13 '24 08:08 0xCarnival

You have to close all terminals after editing, maybe even restart for all terminal sessions to restart. It didn't work for me either at first but after closing all terminals (or restarting) it should work fine.

liebki avatar Aug 13 '24 08:08 liebki

Unfortunately, I tried doing that, restarting, and it is still stuck in the DNS part.

On Tue, Aug 13, 2024 at 3:36 PM Kim @.***> wrote:

You have to close all terminals after editing, maybe even restart for all terminal sessions to restart. It didn't work for me either at first but after closing all terminals (or restarting) it should work fine.

— Reply to this email directly, view it on GitHub https://github.com/mac-cleanup/mac-cleanup-py/issues/192#issuecomment-2285681154, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWRC6D7VBALAX3EGJHWSIMDZRHAQNAVCNFSM6AAAAABMIB5MMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBVGY4DCMJVGQ . You are receiving this because you were mentioned.Message ID: @.***>

0xCarnival avatar Aug 13 '24 16:08 0xCarnival

@0xCarnival alright then I'm almost out of ideas.

The only idea I have left is that you eventually have multiple versions installed. Like multiple homebrew versions or homebrew and PIP etc.

For example you installed using PIP and homebrew but the PIP-one is executed but the homebrew one is modified (check that at least).

liebki avatar Aug 14 '24 05:08 liebki

Hey Kim,

All right, I did that. I in fact deleted both, and did a fresh homebrew install.

Now it gets stuck at:

⠋ Purging inactive memory ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:-- 0:00:00⠋ Purging inactive memory ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:-- 0:19:19

On Wed, Aug 14, 2024 at 12:02 PM Kim @.***> wrote:

@0xCarnival https://github.com/0xCarnival alright then I'm almost out of ideas.

The only idea I have left is that you eventually have multiple versions installed. Like multiple homebrew versions or homebrew and PIP etc.

For example you installed using PIP and homebrew but the PIP-one is executed but the homebrew one is modified (check that at least).

— Reply to this email directly, view it on GitHub https://github.com/mac-cleanup/mac-cleanup-py/issues/192#issuecomment-2287860579, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWRC6D4X5D4TERFL66DNH4TZRLQFXAVCNFSM6AAAAABMIB5MMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBXHA3DANJXHE . You are receiving this because you were mentioned.Message ID: @.***>

0xCarnival avatar Aug 14 '24 07:08 0xCarnival

@0xCarnival here I can just agree this freezes too. I can use the command in terminal but with the tool it doesn't work.

You have to comment this out too (Line 419), those are things which need bugfixes.. maybe I find a way to do that.

liebki avatar Aug 14 '24 07:08 liebki

@all

Just use the configure option -c to disable the two things instead of changing the code.. I forgot that we can do that.

So just do mac-cleanup-py -c and deselect memory and DNS and it should run trough.

liebki avatar Aug 14 '24 14:08 liebki

That worked, thank you!

On Wed, Aug 14, 2024 at 9:31 PM Kim @.***> wrote:

@ALL https://github.com/ALL

Just use the configure option -c to disable the two things instead of changing the code.. I forgot that we can do that.

So just do mac-cleanup-py -c and deselect memory and DNS and it should run trough.

— Reply to this email directly, view it on GitHub https://github.com/mac-cleanup/mac-cleanup-py/issues/192#issuecomment-2288947914, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWRC6D232W6VRACDGHFWO7LZRNS3NAVCNFSM6AAAAABMIB5MMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBYHE2DOOJRGQ . You are receiving this because you were mentioned.Message ID: @.***>

0xCarnival avatar Aug 14 '24 14:08 0xCarnival

Please let the issue open tho, it's still a/multiple bug/s

liebki avatar Aug 14 '24 14:08 liebki

so I'm 100% sure sudo prompt is the culprit, but I'm not sure why:
I mean shell is set to True in Popen and you have to see native password prompt in the terminal, but you don't.

Can you specify the terminal emulator you use + the shell that is being used?
I've already checked warp, iterm, and default terminal w/ default macos shell, aka zsh, and bash, and it all works fine 🤷‍♂️

efa2d19 avatar Sep 08 '24 22:09 efa2d19

so I'm 100% sure sudo prompt is the culprit, but I'm not sure why: I mean shell is set to True in Popen and you have to see native password prompt in the terminal, but you don't.

Can you specify the terminal emulator you use + the shell that is being used? I've already checked warp, iterm, and default terminal w/ default macos shell, aka zsh, and bash, and it all works fine 🤷‍♂️

I have the same issue. I use default terminal + zsh. I ran into this problem after I used it for a few months.

emeis avatar Sep 29 '24 10:09 emeis

I have the same issue. I use default terminal + zsh. I ran into this problem after I used it for a few months.

Could you please try modifying your pam.d to accept touchId on sudo prompt?
You can check this repo or just check how it's done in how-does-it-work section and make changes yourself.
I think it'll solve the issue for time being meanwhile i'll look for a fix

efa2d19 avatar Sep 29 '24 16:09 efa2d19

I have the same issue. I use default terminal + zsh. I ran into this problem after I used it for a few months.

Could you please try modifying your pam.d to accept touchId on sudo prompt? You can check this repo or just check how it's done in how-does-it-work section and make changes yourself. I think it'll solve the issue for time being meanwhile i'll look for a fix

It works, thank you!

emeis avatar Sep 29 '24 19:09 emeis

If you're using homebrew to download mac-cleanup, I prepended the command with sudo and it fixes the DNS and inactive memory issues.

JoshJarabek7 avatar Jan 15 '25 16:01 JoshJarabek7

@JoshJarabek7

Fix or Workaround

liebki avatar Jan 15 '25 16:01 liebki

+1

If you're using homebrew to download mac-cleanup, I prepended the command with sudo and it fixes the DNS and inactive memory issues.

This worked for me too! No issues. Appreciate you, and jumping in with that!

theperfectwill avatar Jan 16 '25 14:01 theperfectwill

Maybe this issue can be solved as using naitve terminal + sudo command. It worked for me 🧑🏻‍💻😇

Cherryshine avatar Aug 31 '25 07:08 Cherryshine

@ALL

Just use the configure option -c to disable the two things instead of changing the code.. I forgot that we can do that.

So just do mac-cleanup-py -c and deselect memory and DNS and it should run trough.

worked for me, thanks, saved 24GB of Storage

MSayib avatar Oct 29 '25 07:10 MSayib

I meet the same issue, I guess just running sudo mac-cleanup -n can resolve it

KitteeRusty avatar Nov 05 '25 00:11 KitteeRusty