Skip to main content

pymacos


A Pythonic interface to macOS

Control your whole Mac from Python: apps, notifications, input, screen, camera, microphone, OCR, media, Keychain, Touch ID and more, with one import and zero dependencies.

docs Documentation Status
tests GitHub Actions build status (Lint) GitHub Actions build status (Test on macOS and Linux) GitHub Actions build status (Build: the package built, installed and tested) Code coverage
package Newest PyPI version Supported Python versions Platform Typed License
import macos

macos.notify("Build finished", title="CI")
macos.say("Done!")

macos.clipboard.copy("hello")
macos.appearance.is_dark()                      # True
macos.screenshot("screen.png")

macos.apps.open("Safari")                       # App(name='Safari', ...)
macos.keychain.get("my-app", "alice")           # 's3cret'

macos.power.battery()                           # Battery(percent=87, charging=True, ...)
macos.shortcuts.run("Translate", input="Hola")  # 'Hello'
macos.finder.trash("old.log")                   # moved to the Trash

What's inside

Area Topics
Apps & Automation Apps, Browser, Clipboard, Events, Hotkeys, Keyboard, Maps, Menu Bar, Mouse, Music, Schedule, Shortcuts, Windows
User Interaction Dialogs, Notifications, Sound, Speech
Files & Documents Audio Files, Documents, Finder, Images, PDF, Spotlight, Video
Intelligence Language, Vision
Security Authentication, Keychain
System & Hardware Appearance, Audio, Bluetooth, Camera, Defaults, Dock, Network, Power, Printer, Screen, Settings, System, Time Machine, Trackpad, Volume

Install

pip install pymacos

The package is installed as pymacos and imported as macos.

Requires macOS and Python 3.9+.

Why

A notification from plain Python means AppleScript inside a string, which breaks as soon as the message contains a quote:

subprocess.run(["osascript", "-e", 'display notification "Build finished" with title "CI"'])

With pymacos:

macos.notify("Build finished", title="CI")

Across the whole package:

  • No dependencies: no PyObjC, nothing to compile.
  • Plain, typed functions that return Python objects.
  • Any text is safe: your text is never pasted into shell or AppleScript source.
  • Clear errors when macOS is missing a permission, instead of silent failures.

See Why pymacos? for a longer comparison.

Documentation

The full guide and API reference are at macos.readthedocs.io.

License

Released under the MIT License — free for personal and commercial use.

Not affiliated with or endorsed by Apple Inc. macOS is a trademark of Apple Inc.

Metadata

Release files for pymacos 1.25.1

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

Source distribution (sdist)

Source distribution for pymacos 1.25.1
File Size Uploaded
pymacos-1.25.1.tar.gz 649.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymacos 1.25.1
File Interpreter ABI Platform
pymacos-1.25.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.0 MB

Release files / pymacos-1.25.1.tar.gz

Download URL pymacos-1.25.1.tar.gz
Size 649.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1f84689efd3681b76f9819f9e4ed5db0f53624f2a3a701b77cc149dc72ee9b4e
BLAKE2b-256 checksum
How to use checksums
719ffa722a40419d1525111ed9b074a137ba0c1cfcec198ad36484909306ea0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release files / pymacos-1.25.1-py3-none-any.whl

Download URL pymacos-1.25.1-py3-none-any.whl
Size 367.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d14cc88c87fc0726c78f93d2d6f05d7f448b0790b3e14893835a0319d3b32d1
BLAKE2b-256 checksum
How to use checksums
c3c28435bc7be537b9835af138beb9307420373b1eed3276a237e66551b4daf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release history Release notifications | RSS feed

1.27.0

2 release files

1.26.0

2 release files

1.25.3

2 release files

1.25.2

2 release files

This release

1.25.1 This release

2 release files

1.25.0

2 release files

1.24.2

2 release files

1.24.1

2 release files

1.24.0

2 release files

1.23.0

2 release files

1.18.0

2 release files

1.17.0

2 release files

1.16.0

2 release files

1.15.0

2 release files

1.14.0

2 release files

1.13.0

2 release files

1.12.0

2 release files

1.11.0

2 release files

1.10.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

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