Skip to main content

A simple utility to clean your mac of old stuff

Project description

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cleanmymac-0.1.13.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

cleanmymac-0.1.13-py2-none-any.whl (22.7 kB view details)

Uploaded Python 2

File details

Details for the file cleanmymac-0.1.13.tar.gz.

File metadata

  • Download URL: cleanmymac-0.1.13.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cleanmymac-0.1.13.tar.gz
Algorithm Hash digest
SHA256 2247676418090e219098bf999a61ab790169a8523474e8d9fd6c22c78e4634b9
MD5 0e485ef0d466356592e9f9bd9c92466a
BLAKE2b-256 f9fc7c24e29428526e2d643fed52bf69c52fe6d60193281cc94440a9745224d1

See more details on using hashes here.

File details

Details for the file cleanmymac-0.1.13-py2-none-any.whl.

File metadata

File hashes

Hashes for cleanmymac-0.1.13-py2-none-any.whl
Algorithm Hash digest
SHA256 f30a136e28f40d67bc3f260fd36506efe71126c72c2a423063e09773163e9881
MD5 4972bb37a599eb36a7e697705bc68540
BLAKE2b-256 6c40a6b2ed8c938755f96696d930bb942d1e586f718b21639a4148c0ea3d95d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page