mac-cleanup / mac-cleanup-py Goto Github PK
View Code? Open in Web Editor NEW๐จโ๐ป Python cleanup script for macOS
License: Apache License 2.0
๐จโ๐ป Python cleanup script for macOS
License: Apache License 2.0
I basically forgot to update options in README.
Maybe I should add CI for that later ๐ธ
mac-cleanup -h
usage: mac-cleanup [-h] [-n] [-u] [-c] [-p] [-f]
Python cleanup script for macOS
Version: 3.0.4
https://github.com/mac-cleanup/mac-cleanup-py
options:
-h, --help show this help message and exit
-n, --dry-run Run without deleting stuff
-u, --update Update Homebrew on cleanup
-c, --configure Open module configuration screen
-p, --custom-path Specify path for custom modules
-f, --force Accept all warnings
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
~/Library/Group Containers/11111111111.ru.keepcoder.Telegram/stable/account-11111111111/postbox/db
where 11111111111
- some unique idThis is a great utility script! Is there a way to run this utility in a non-interactive manner? I'm trying to use this as a maintenance script that is launched by my RMM platform without the need to choose options (or have the options as arguments on the command line). Thanks!
Hi, I've just installed mac-cleanup-py and configured it to delete just my user-specific caches (~/.android/cache and similar). Even so, the script asks me for password via sudo. From a quick look at the code it seems it automatically uses sudo for every command? https://github.com/mac-cleanup/mac-cleanup-py/blob/main/mac_cleanup/core_modules.py#L64
That seems unfortunate, as it's a good general principle to not escalate privileges unless it's absolutely necessary. And sudo should not be necessary for just deleting files in my own home folder...?
The dry run returns the following result: "Approx 26.11 GB will be cleaned." After confirming the continuation of the procedure and saying 'yes' to each questions along it, Mac-Cleanup reports about 700 Mb having been deleted. But after re-running the script, it returns the same result: "Approx 26.11 GB will be cleaned." What am I doing wrong?
When running the dry-run, I noticed it got an output of ~10GB(forgot to screenshot) and after running, it reported cleaning 99GB.
What I noticed is that the only difference on the runs is that the actual run asked for my password, so I got investigating the code a bit and this bit of code seems to be the "problem"/masking the difference:
except (PermissionError, FileNotFoundError):
continue
What do you think of adding a option to force it to get all the permissions for dry-run too?
Also great work on this project! Simple and effective โค๏ธ
please support Python 3.12.
Thanks!
Installed via pip, running I get:
mac-cleanup -h
Traceback (most recent call last):
File "/Users/rich/.pyenv/versions/3.8.7/bin/mac-cleanup", line 5, in <module>
from mac_cleanup.cli import main
File "/Users/rich/.pyenv/versions/3.8.7/lib/python3.8/site-packages/mac_cleanup/cli.py", line 1, in <module>
from mac_cleanup.utils import CleanUp, cmd, bytes_to_human, catch_exception
File "/Users/rich/.pyenv/versions/3.8.7/lib/python3.8/site-packages/mac_cleanup/utils.py", line 13, in <module>
tuple[Type[BaseException]],
TypeError: 'type' object is not subscriptable
python -V
Python 3.8.7
Describe the bug
it wasn't supposed to remove docker images as the bash script never removed my containers if necessary should be asked using a prompt or something.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
should ask for a prompt in case the user wants to keep them!
Hello,
I have some apps that are running in the background. In my specific case, the "Allow in the Background" login items are coming from /Library/LaunchAgents. It would be great to be able to list and delete them in case a user is not interested in having them start up.
Applications that run on Startup
ls -lah /Library/StartupItems
Property list (plist) items running on startup
ls -lah ~ /Library/LaunchAgents
ls -lah /Library/LaunchAgents
ls -lah /Library/LaunchDaemons
ls -lah /System/Library/LaunchDaemons
Applications that launch on User Login
ls -lah /Library/LaunchAgents
ls -lah ~/Library/LaunchAgents
ls -lah /System/Library/LaunchAgents
default_modules.py
every time isn't the solution here.inquirer
has something to offer.inquirer
to something else if implementation would be hard or impossible.Describe the bug
FileNotFoundError if there are symlinks inside a dir
When trying to run the program it stuck at Clearing System Cache Files 0%.
`
$ python3 -m platform
macOS-12.3.1-arm64-arm-64bit
$ mac-cleanup
Clearing System Cache Files... โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 0% -:--:--`
There are no debug keys so cant diagnose what can be wrong.
First off, thanks for you work on this!
Just an idea but I feel like there could be a better configuration message than [?] Active modules:
. To someone new it's not incredibly intuitive what this is referring to (I personally thought this was referring to modules I DON'T want to touch).
Maybe something alone the lines of Select the modules you want to clean:
?
You could add subtext Warning: Clearing cache files may result in temporary performance changes in some applications.
to educate users what this is doing since it's obviously always a little scary to have something deleting files on your computer.
Just some thoughts, I'd be glad to open a PR if you see this as helpful.
Expected Behaviour: If run mac-cleanup a second time, I should see Removed - 0 MB
Observed Behaviour: Non-zero return after consecutive runs
3.0.4
Run mac-cleanup consecutively.
A copy of an issue from mac-cleanup-sh
from @jeffmurch
Will be fixed in v3.0.0
The cleanup code in the custom module is not executed
mac-cleanup --custom
and specify the directory path of the custom modulemac-cleanup -n
or mac-cleanup
.Minimum example code to reproduce it (based on module_template.py)
"""Custom module template example."""
from mac_cleanup import *
# Do not import any functions at the top level
print("running example") # is printed
# Get an instance of Collector
clc = Collector()
# You can create lots of modules in one file
def module_example_2():
print("running example cleanup")
with clc as unit:
unit.message("test file")
unit.add(Path("~/dotfiles/mac-cleanup-module/test").with_prompt("Delete test file?"))
Based on example above, directory and files are not deleted and prompt is not shown.
The statement print("running example")
is executed, however this print("running example cleanup")
statement is never executed
Basically, task for myself. Don't want to forget about it ๐ธ
There is a problem with config file. On every update or reinstall it'll be deleted. That's not convenient and counter intuitive, imho.
v3.0.0
warning were added, but it's annoying to accept all of them every time.-f
and --force
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.