Skip to main content

cleanmymac

A simple command line tool to clean old stuff from your mac.

documentation

http://cleanmymac.readthedocs.org/en/latest/

usage

$ cleanmymac -h
Usage: cleanmymac [OPTIONS] TARGETS

  the main **run** method, responsible for creating the parser and executing
  the main logic in **cleanmymac**

  :param bool update: perform update of targets (if applicable) :param
      dry_run: do not execute the actions, but log the result :param quiet:
      quiet mode (no output), show a progressbar instead :param strict: if set
      enforce strict(er) rules when validating targets :param list_targets: list
      the installed targets :param stop_on_error: abort the execution on first
      error :param config: the configuration path :param targets_path: extra
      targets paths :param targets: the targets

    Options:
      -L, --log-level LVL      Either CRITICAL, ERROR, WARNING, INFO or DEBUG
      -u, --update             update the target if applicable
      -d, --dry_run            describe the actions to be performed, do not
                               execute them
      -q, --quiet              run in quiet mode
      --strict / --no-strict   strict mode: enforce strict(er) rules when
                               validating targets
      -l, --list               list registered cleanup targets
      -s, --stop_on_error      stop execution when first error is detected
      -c, --config TEXT        specify the configuration path
      -t, --targets_path PATH  specify extra yaml defined targets path
      --version                Show the version and exit.
      -?, -h, --help           Show this message and exit.

a typical usage pattern is:

$ cleanmymac

or (in quiet mode)

$ cleanmymac -q

installation

install from pypi:

$ pip install cleanmymac

clone the repository locally and issue

$ python setup.py install

configuration

the cleanmymac utility accepts a configuration file by specifying the -c option. If not specified the file is assumed to be at the following location ~/.cleanmymac.yaml

the global configuration can be used (for now) to pass specific env vars to shell commands, for example assume that anaconda is not in the main path:

cleanmymac: {
  targets_path: ['.']
}
anaconda: {
  env: {
    PATH: '~/anaconda/bin',
  },
}

extensibility

one can add more cleanup targets either by installing them as python classes registered to the following entry-point: cleanmymac.target like this (in setup.py):

entry_points={
    # ....
    'cleanmymac.target': [
        'my_target_name = my.python.package.MyTargetClass'
    ]
    # ...
}

alternatively for shell based commands simply create yaml files with the following schema:

type: 'cmd'
spec: {
  update_commands: [
    'brew update',
    'brew outdated | brew upgrade'
  ],
  clean_commands: [
    'brew cleanup'
  ]
}

or for cleaning up directories (removing all but the latest version):

type: 'dir'
spec: {
    update_message: 'Get the latest MacTex version from https://www.tug.org/mactex/',
    entries: [
        {
            dir: '/usr/local/texlive/',
            pattern: '\d+'
        },
    ]
}

note: see the cleanmymac.builtins module for more details

and point cleanmymac to the folder where the yaml files reside with the -t command line option

builtin targets

to see a list of builtin targets run:

$ cleanmymac -l
currently the following are supported:
  • homebrew

  • java jdk

  • mactex

  • anaconda

  • trash

disclaimer

I created this utility in the hope that others may find it useful, as I found it annoying to always remember how and what to clean from my mac. This is work in progress, so use at your own risk!

Metadata

Release files for cleanmymac 0.1.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cleanmymac 0.1.17
File Size Uploaded
cleanmymac-0.1.17.tar.gz 18.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cleanmymac 0.1.17
File Interpreter ABI Platform
cleanmymac-0.1.17-py2-none-any.whl Python 2 none any Details

Total release size: 94.3 kB

Release files / cleanmymac-0.1.17.tar.gz

Download URL cleanmymac-0.1.17.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
eebf4225bcfa944aaf3b2244a36d324bba60105d136156d42b1e3487331cf27f
BLAKE2b-256 checksum
How to use checksums
42b356bc90881e97571e0ef46e0571afda1b280a649941697e756dc9ae4e2df1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / cleanmymac-0.1.17-py2-none-any.whl

Download URL cleanmymac-0.1.17-py2-none-any.whl
Size 75.6 kB
Tags Python 2
SHA-256 checksum
How to use checksums
213b2168b36380d051c279320f44a28b8530c015687245ebf2f8b8b3676e3f4d
BLAKE2b-256 checksum
How to use checksums
7ef3bc2e26c3afd05be8d4b8e5e248ddb49ccd7d270dcbc2e94e55f9e2922105
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.17 This release

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.9

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page