launchd is a pythonic interface to interact with OS X’s launchd. It provides access to basic querying and interaction with launchd. It is implemented using the Objective C ServiceManagement framework as well as the launchd command line utility. Therefore, this python package can only be used on OS X
The python objective C bridge contains some special types. This package strips off all non built-in type information and returns pure python data.
Examples
The relevant import statement is:
import launchd
Listing all launchd jobs:
for job in launchd.jobs():
print(job.label, job.pid, job.laststatus, job.properties, job.plistfilename)
Find the pid and laststatus of a job:
>>> launchd.LaunchdJob("com.apple.Finder").pid
278
>>> launchd.LaunchdJob("com.apple.Finder").laststatus
0
>>> launchd.LaunchdJob("com.example.fubar").pid
Traceback (most recent call last):
File "launchd/launchctl.py", line 78, in refresh
raise ValueError("job '%s' does not exist" % self.label)
ValueError: job 'com.example.fubar' does not exist
Detect if a job exists:
>>> launchd.LaunchdJob("com.example.fubar").exists()
False
launchd job properties (these come directly from launchd and NOT the .plist files):
>>> launchd.LaunchdJob("com.apple.Finder").properties
{'OnDemand': 1, 'PID': 278, 'PerJobMachServices': {'com.apple.coredrag': 0,
'com.apple.axserver': 0, 'com.apple.CFPasteboardClient': 0,
'com.apple.tsm.portname': 0}, 'LimitLoadToSessionType': 'Aqua',
'Program': '/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder',
'TimeOut': 30, 'LastExitStatus': 0, 'Label': 'com.apple.Finder',
'MachServices': {'com.apple.finder.ServiceProvider': 10}}
>>> launchd.LaunchdJob("com.apple.Finder").properties["OnDemand"]
1
Find all plist filenames of currently running jobs:
for job in launchd.jobs():
if job.pid is None or job.plistfilename is None:
continue
print(job.plistfilename)
Job properties of a given job (this uses the actual .plist file):
>>> launchd.plist.read("com.apple.kextd")
{'ProgramArguments': ['/usr/libexec/kextd'], 'KeepAlive': {'SuccessfulExit': False},
'POSIXSpawnType': 'Interactive', 'MachServices': {'com.apple.KernelExtensionServer':
{'HostSpecialPort': 15}}, 'Label': 'com.apple.kextd'}
Installation
$ pip install launchd
or, if you want to work using the source tarball:
$ python setup.py install
Requirements
OS X >= 10.6
Python 3.4+
Release history
0.2.0 (March 2021)
drop python 2.x, 3.2, 3.3 support
fix plistlib calls (issue #4)
0.1.2 (September 2020)
added tox.ini for easier testing accross interpreter versions
added travis test setup
fixed incompatibility with launchctl in test code
fixed a typo in the README
0.1.1 (November 2013)
Fixed a bug in launchd.plist.read() when no scope was specified
0.1 (November 2013)
Focus: initial public release
Metadata
Release files for launchd 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| launchd-0.2.0.tar.gz | 9.5 kB | Without provenance | Details for launchd-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| launchd-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for launchd-0.2.0-py3-none-any.whl |
Total release size: 19.6 kB
Release files / launchd-0.2.0.tar.gz
| Download URL | launchd-0.2.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
315e4aa41774da8c1f9f3edf1aa32bbcd8a6903f02eff21065780d23054f7ace
|
|
BLAKE2b-256 checksum How to use checksums |
e1cf1cedc089d918d6456ddb09cce0d4dd1f093e7efb74c507bf7aba17c2e6b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.8
|
Release files / launchd-0.2.0-py3-none-any.whl
| Download URL | launchd-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3eaf9607ce8086cfa9951fa4a365f3825f5c633b257ab157280238e26e63be23
|
|
BLAKE2b-256 checksum How to use checksums |
f14428d81902e4268c3ffcef728ffaf8539e744cbec3c275c9568f3676668375
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.8
|
Security for launchd 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.