Skip to main content

Package day-care manager on macOS.

Project description

Platform:

OS X Yosemite, OS X El Capitan, macOS Sierra macOS High Sierra, macOS Mojave

Language:

Python (version ≥ 3.4)

Environment:

Console | Terminal

MacDaily

download version format status

python implementation


About

Package day-care manager on macOS.

MacDaily is a mediate collection of console scripts written in Python with support of PTY. Originally works as an automatic housekeeper for Mac to update all packages outdated, MacDaily is now fully functioned and end-user oriented. Without being aware of everything about your Mac, one can easily work around and manage packages out of no pain using MacDaily.

Installation

NB

MacDaily runs only with support of Python from version 3.4 or higher. And it shall only work ideally on macOS.

Just as many Python packages, MacDaily can be installed through pip using the following command, which will get you the latest version from PyPI.

$ pip install macdaily

Or if you prefer the real-latest version and fetch from this Git repository, then the script below should be used.

$ git clone https://github.com/JarryShaw/MacDaily.git
$ cd MacDaily
$ pip install -e .
# and to update at any time
$ git pull

Also, for best performance of MacDaily, the notable automation tool expect is expected to be installed on your Mac. Recommended installation approach is from Homebrew, as shown below.

$ brew install expect

Or if you prefer not to install unbuffer, MacDaily will use UNIX script utility instead. Make sure that /usr/bin/script exists and /usr/bin is in your PATH environment variable.

For the worst case, MacDaily adopts ptyng as an alternative. It is a revised version of Python pty module, intended to support pseudo-terminal (PTY) on macOS with no further issue. To install ptyng, you may use the script below.

$ pip install macdaily[ptyng]
# or explicitly...
$ pip install macdaily ptyng

For tree format support in dependency command, you will need dictdumper, then implicitly you can use the following script to do so.

$ pip install macdaily[tree]
# or explicitly...
$ pip install macdaily dictdumper

And ConfigUpdater is required to support modification of configuration file in config command, since MacDaily intend to maintain the original layout and information of a configuration file after modifying it. To install, the sample script is as below.

$ pip install macdaily[config]
# or explicitly...
$ pip install macdaily configupdater

To install all requirements for full support of MacDaily, you may simply run the following script when installation.

$ pip install macdaily[all]
# or explicitly...
$ pip install macdaily configupdater dictdumper ptyng

Configuration

This part might be kind of garrulous, for some may not know what’s going on here. 😉

Since robust enough, MacDaily now supports configuration upon user’s own wish. One may set up log path, hard disk path, archive path and many other things, other than the default settings.

NB

MacDaily now supports configuration commands, see manual of config command for more information.

The configuration file should lie under ~/.dailyrc, which is hidden from Finder by macOS. To review or edit it, you may use text editors like vim and/or nano, or other graphic editors, such as Sublime Text and/or Virtual Studio Code, or whatever you find favourable.

[Path]
# In this section, paths for log files are specified.
# Please, under any circumstances, make sure they are valid.
logdir = ~/Library/Logs/MacDaily                            ; path where logs will be stored
dskdir = /Volumes/Your Disk                                 ; path where your hard disk lies
arcdir = ${dskdir}/Developers                               ; path where ancient logs archive

[Mode]
# In this section, flags for modes are configured.
# If you would like to disable the mode, set it to "false".
apm     = true                                              ; Atom plug-ins
app     = true                                              ; macOS Applications
brew    = true                                              ; Homebrew Formulae
cask    = true                                              ; Homebrew Casks
cleanup = true                                              ; cleanup caches
gem     = true                                              ; Ruby gems
mas     = true                                              ; Mac App Store applications
npm     = true                                              ; Node.js modules
pip     = true                                              ; Python packages
system  = true                                              ; macOS software
tap     = true                                              ; Homebrew Taps

[Daemon]
# In this section, scheduled tasks are set up.
# You may append and/or remove the time intervals.
archive     = false                                         ; archive logs
bundle      = false                                         ; bundle packages
cleanup     = false                                         ; cleanup caches
config      = false                                         ; config MacDaily
dependency  = false                                         ; show dependencies
install     = false                                         ; install packages
launch      = false                                         ; launch daemons
logging     = true                                          ; log installed packages
postinstall = false                                         ; postinstall packages
reinstall   = false                                         ; reinstall packages
uninstall   = false                                         ; uninstall packages
update      = true                                          ; update packages
schedule    =                                               ; scheduled timing (in 24 hours)
    8:00                                                    ; update & logging at 8:00
    22:30-update                                            ; update at 22:30
    23:00-logging                                           ; logging at 23:00

[Command]
# In this section, command options are picked.
# Do make sure these options are available for commands.
update  = --all --quiet --show-log
logging = --all --quiet --show-log

[Miscellanea]
# In this section, miscellaneous specifications are assigned.
# Please, under any circumstances, make sure all fields are valid.
askpass = ...                                               ; SUDO_ASKPASS utility for Homebrew Casks
confirm = ...                                               ; confirm utility for MacDaily
timeout = 300                                               ; timeout limit for shell commands in seconds

Above is the default content of .dailyrc, following the grammar of INI files. Lines and words after number sign (#) and semicolon (;) are comments, whose main purpose is to help understanding the contents of this file.

In section Path, there are path names where logs and some other things to be stored. In section Mode, there are ten different modes to indicate if they are enabled or disabled.

You may wish to set the dskdirpath where your hard disk lies, which allows MacDaily to archive your ancient logs and caches into somewhere never bothers.

Please NOTE that, under all circumstances, of section Path, all values would better be a valid path name without blank characters (' \t\n\r\f\v'), except your hard disk dskdir.

Besides, in section Daemon, you can decide which command is scheduled and when to run such command, with the format of HH:MM[-CMD]. The CMD is optional, which will be any if omits. And you may set up which command(s) will be registered as daemons and run with schedule through booleans above. These boolean values help MacDaily indicate which is to be launched when commands in schedule omit. That is to say, when CMD omits in schedule, MacDaily will register all commands that set true in the above boolean values.

Also, in section Option, you may set up optional arguments for the daemons above. Do please make sure these commands are valid. And if omit, an empty arguments will be given.

Last but no least, in section Miscellanea, you should NEVER modify any contents under this section in order to keep MacDaily working. However, you may set up this part with config command.

Usage Manual

usage: macdaily [options] <command> ...

macOS Automate Package Manager

optional arguments:
  -h, --help     show this help message and exit
  -V, --version  show program's version number and exit

Commands:
  MacDaily provides a friendly CLI workflow for the administrator of macOS
  to manipulate packages

Start-Up

Before we dive into the detailed usage of MacDaily, let’s firstly get our hands dirty with some simple commands.

NOTE – all acronyms and aliases are left out for a quick and clear view of MacDaily

  1. How to use MacDaily?

# call from PATH
$ macdaily [command ...] [option ...]
# or call as Python module
$ python -m macdaily [command ...] [option ...]
# or call a certain command
$ md-${command} [option ...]
  1. How to set up my disks and daemons interactively?

$ macdaily config --interactive
  1. How to relaunch daemons after I manually modified ~/.dailyrc?

$ macdaily launch daemons
  1. How to archive all ancient logs without running any commands?

$ macdaily archive --all
  1. How to update all outdated packages?

$ macdaily update --all
  1. How to update a certain package (eg: hello from Homebrew)?

$ macdaily update brew --package=hello
  1. How to update without a certain package (eg: update all packages except Python package ptyng)?

$ macdaily update --all --pip='!ptyng'
  1. How to uninstall a certain package along with its dependencies (eg: pytest from brewed CPython version 3.6)?

$ macdaily uninstall pip --brew --cpython --python=3.6 --package pytest
  1. How to reinstall all packages but do not cleanup caches?

$ macdaily reinstall --all --no-cleanup
  1. How to postinstall packages whose name ranges between “start” and “stop” alphabetically?

$ macdaily postinstall --all --start=start --end=stop
  1. How to show dependency of a certain package as a tree (eg: gnupg from Homebrew) ?

$ macdaily dependency brew  --tree --package=gnupg
  1. How to log all applications on my Mac, a.k.a. *.app files?

$ macdaily logging dotapp
  1. How to dump a Macfile to keep track of all packages?

$ macdaily bundle dump

Commands

MacDaily supports several different commands. Of all commands, there are corresponding aliases for which to be reckoned as valid.

Command

Aliases

archive

bundle

cleanup

clean

config

cfg

dependency

deps, dp

help

doc

install

i

launch

init

logging

log

postinstall

post, ps,

reinstall

re

uninstall

un, unlink, remove, rm, r

update

up, upgrade

For more information, MacDaily provides commands to help you find out the expecting command.

$ macdaily commands
MacDaily available commands & corresponding subsidiaries:
    archive
    bundle          dump, load
    cleanup         brew, cask, npm, pip
    config
    dependency      brew, pip
    install         apm, brew ,cask, gem, mas, npm, pip, system
    launch          askpass, confirm, daemons
    logging         apm, app, brew, cask, gem, mas, npm, pip, tap
    postinstall
    reinstall       brew, cask
    uninstall       brew, cask, pip
    update          apm, brew, cask, gem, mas, npm, pip, system

Generals

The man page of MacDaily shows as below.

$ macdaily --help
usage: macdaily [-h] command

Package Day Care Manager

optional arguments:
  -h, --help     show this help message and exit
  -V, --version  show program's version number and exit

Commands:
  macdaily provides a friendly CLI workflow for the administrator of macOS to
  manipulate packages

Commands for macdaily is shown as above and they are mandatory. For more detailed usage information, please refer to manuals of corresponding commands. For developers, internal details can be found in miscellanea manual. And here is a brief catalogue for the manuals.

Troubleshooting

  1. Where can I find the log files?

    It depends. Since the path where logs go can be modified through ~/.dailyrc, it may vary as your settings. In default, you may find them under ~/Library/Logs/Scripts. And with every command, logs can be found in its corresponding folder. Logs are named after its running time, in the fold with corresponding date as its name.

    Note that, normally, you can only find today’s logs in the folder, since macdaily automatically archive ancient logs into ${logdir}/archive folder. And every week, ${logdir}/archive folder will be tape-archived into ${logdir}/tarfile. Then after a month, and your hard disk available, they will be moved into /Volumes/Your Disk/Developers/archive.zip.

  2. What if my hard disk ain’t plugged-in when running the scripts?

    Then the archiving and removing procedure will NOT perform. In case there might be some useful resources of yours.

  3. Which directory should I set in the configuration file?

    First and foremost, I highly recommend you NOT to modify the paths in ~/.dailyrc manually, EXCEPT your disk path dskdir.

    But if you insist to do so, then make sure they are VALID and available with permission granted, and most importantly, have NO blank characters (' \t\n\r\f\v') in the path, except dskdir.

TODO

  • ✔️ support configuration

  • ✔️ support command aliases

  • ✔️ reconstruct archiving procedure

  • ❌ support gem and npm in all commands

  • ✔️ considering support more versions of Python

  • ✔️ optimise KeyboardInterrupt handling procedure

  • ❌ implement further specifications for package indication mini-language

  • ✔️ review pip implementation and version indication

  • ✔️ add --user for pip commands

  • ❌ implement bundle and help commands

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

macdaily-2018.11.23a2.tar.gz (724.1 kB view details)

Uploaded Source

Built Distributions

macdaily-2018.11.23a2-py3.7.egg (953.5 kB view details)

Uploaded Source

macdaily-2018.11.23a2-py3.6.egg (953.0 kB view details)

Uploaded Source

macdaily-2018.11.23a2-py3.5.egg (959.1 kB view details)

Uploaded Source

macdaily-2018.11.23a2-py3.4.egg (959.6 kB view details)

Uploaded Source

macdaily-2018.11.23a2-py3-none-any.whl (787.5 kB view details)

Uploaded Python 3

macdaily-2018.11.23a2-pp35-none-macosx_10_14_x86_64.whl (787.5 kB view details)

Uploaded PyPy macOS 10.14+ x86-64

macdaily-2018.11.23a2-cp37-none-macosx_10_14_x86_64.whl (786.8 kB view details)

Uploaded CPython 3.7 macOS 10.14+ x86-64

macdaily-2018.11.23a2-cp36-none-macosx_10_14_x86_64.whl (786.8 kB view details)

Uploaded CPython 3.6 macOS 10.14+ x86-64

File details

Details for the file macdaily-2018.11.23a2.tar.gz.

File metadata

  • Download URL: macdaily-2018.11.23a2.tar.gz
  • Upload date:
  • Size: 724.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1

File hashes

Hashes for macdaily-2018.11.23a2.tar.gz
Algorithm Hash digest
SHA256 d8070e1f9070a6cb9cc4acd1ea313b8155c00ded29b3b188315c9d4ef808491f
MD5 6e1c98c2e7df0b48937ef3cb4280953f
BLAKE2b-256 9680a70a7e939bb179aecd602be61ab8cb423bfe370f272caa3802e5374d3cee

See more details on using hashes here.

File details

Details for the file macdaily-2018.11.23a2-py3.7.egg.

File metadata

  • Download URL: macdaily-2018.11.23a2-py3.7.egg
  • Upload date:
  • Size: 953.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1

File hashes

Hashes for macdaily-2018.11.23a2-py3.7.egg
Algorithm Hash digest
SHA256 6bb3baf42d494b4d57aad56f7a4db529ea45ae6dfddba569bbe7dcda58da83af
MD5 7cf2f4a1ceef3330a562b2424c49cfc8
BLAKE2b-256 746fb8b0b4ddf314eef1b095e0f9274d9cf29a0cad8cef051269e6b42dab7e2e

See more details on using hashes here.

File details

Details for the file macdaily-2018.11.23a2-py3.6.egg.

File metadata

  • Download URL: macdaily-2018.11.23a2-py3.6.egg
  • Upload date:
  • Size: 953.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1

File hashes

Hashes for macdaily-2018.11.23a2-py3.6.egg
Algorithm Hash digest
SHA256 539db60e1722cade2b62d9f1fdd957761a1c4725d8dc499882c0a04e620c9f37
MD5 e01b326a10d4b975a6af69f48a932afc
BLAKE2b-256 dc9115e89554348581b5e8bbf90e77b9149f9328da5ebe7de93a19fc3c9b1882

See more details on using hashes here.

File details

Details for the file macdaily-2018.11.23a2-py3.5.egg.

File metadata

  • Download URL: macdaily-2018.11.23a2-py3.5.egg
  • Upload date:
  • Size: 959.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1

File hashes

Hashes for macdaily-2018.11.23a2-py3.5.egg
Algorithm Hash digest
SHA256 1c288cabe1c530e7ad54abfd0afbff076da2f89fe63c01008fb948c2daefcc31
MD5 432a4d2394dbf08fc8673550f2d361eb
BLAKE2b-256 2c75e01d32b815fb97e2aabd74ffa46481aaf22c03ef32194e80326b1de1515b

See more details on using hashes here.

File details

Details for the file macdaily-2018.11.23a2-py3.4.egg.

File metadata

  • Download URL: macdaily-2018.11.23a2-py3.4.egg
  • Upload date:
  • Size: 959.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1

File hashes

Hashes for macdaily-2018.11.23a2-py3.4.egg
Algorithm Hash digest
SHA256 4e5e7eb42381d3bf9378b0dad821d73d8b7ef39f7f06901bed1fc9f9cc084482
MD5 3b2d380b47d399df5c1bd8096ae2d4a0
BLAKE2b-256 343fe4c4b5a53f2f64b383731d2c4af36bd1a7aa28e63310c32251a5b1343d23

See more details on using hashes here.

File details

Details for the file macdaily-2018.11.23a2-py3-none-any.whl.

File metadata

  • Download URL: macdaily-2018.11.23a2-py3-none-any.whl
  • Upload date:
  • Size: 787.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1

File hashes

Hashes for macdaily-2018.11.23a2-py3-none-any.whl
Algorithm Hash digest
SHA256 8983b02b8e7bd4cd64f3fb26736e5be2f5a0d581c4031d51af45b8781eb430b8
MD5 47ee9ddc6a0404abc2f97cc04e768312
BLAKE2b-256 dfcf23f7219d92c3d3d1515c35b8c92f2396d294bdcbcd25f5e4ece74bcd372d

See more details on using hashes here.

File details

Details for the file macdaily-2018.11.23a2-pp35-none-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: macdaily-2018.11.23a2-pp35-none-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 787.5 kB
  • Tags: PyPy, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1

File hashes

Hashes for macdaily-2018.11.23a2-pp35-none-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 3884d240613137d587f7f07fa99a21f8b8c163d72174b0969f0206c7859e1f98
MD5 f7983446321f653da307f8f72ca08d3e
BLAKE2b-256 53ee43d3ecc8686756f3d0a2e98b8a8cb2e3c2770f675d06ea9dde11ab37221f

See more details on using hashes here.

File details

Details for the file macdaily-2018.11.23a2-cp37-none-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: macdaily-2018.11.23a2-cp37-none-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 786.8 kB
  • Tags: CPython 3.7, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1

File hashes

Hashes for macdaily-2018.11.23a2-cp37-none-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 3a98474e41455d81f49b030939ce349874ef3b0f13ca209b2fce534859071afd
MD5 4a2441f01b5ee84cb594d8d916675f8a
BLAKE2b-256 b183ab6f6308fc122cbdc3e116d4094d4256fb7ba66ab5ad20a60284c4b8776d

See more details on using hashes here.

File details

Details for the file macdaily-2018.11.23a2-cp36-none-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: macdaily-2018.11.23a2-cp36-none-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 786.8 kB
  • Tags: CPython 3.6, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1

File hashes

Hashes for macdaily-2018.11.23a2-cp36-none-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 6c5c7283c5639463943adb027196182446be3e66a882620605809bbed9beb8e8
MD5 74f85dd3e389aa76f66d555d9abde66b
BLAKE2b-256 f3a1fd54a9b10e3e3c9992cb9ac633544dd99203a3c37af952766c6a1e7f4d59

See more details on using hashes here.

Supported by

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