Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
OSLog
✓ import OSLog
The framework's functionality is exposed directly under the 'OSLog' module name.
OSLog.os_log_create
✓ from OSLog import os_log_create
Functions are typically available directly within the imported OSLog module.
This quickstart demonstrates how to import the OSLog framework and log a simple message to the macOS unified logging system. It shows how to create a log handle and then use `os_log_with_type` to send a message. You can view these logs using macOS's Console.app.
import OSLog
from Foundation import NSObject
def main():
# Instantiate an OSLog object (equivalent to Objective-C: [[OSLog alloc] initWithSubsystem:category:])
# os_log_create is an alternative to OSLog.alloc().init...
log_handle = OSLog.os_log_create('com.example.myapp', 'general')
# Log a message at the default level (OS_LOG_TYPE_DEFAULT)
# Equivalent to Objective-C: os_log(log_handle, "Hello from PyObjC OSLog!");
# Note: For simplicity, string formatting and privacy modifiers (%{public}s, %{private}s) are not shown here
# as they typically apply to C-level os_log calls. PyObjC handles basic strings directly.
OSLog.os_log_with_type(log_handle, OSLog.OS_LOG_TYPE_DEFAULT, 'Hello from PyObjC OSLog!')
print('Logged a message to system console. Check Console.app for "Hello from PyObjC OSLog!".')
if __name__ == '__main__':
main()
Debug
Known issues
breakingPyObjC 12.x (including pyobjc-framework-oslog 12.1) officially drops support for Python 3.9. PyObjC 11.x dropped support for Python 3.8.fixEnsure your Python environment is 3.10 or later. Upgrade Python if necessary.
affects: 11.0, 12.0+
breakingPyObjC 11.1 introduced significant changes to align the core bridge's Automatic Reference Counting (ARC) behavior with `clang`'s documentation for initializer methods. Methods in the 'init' family now correctly steal and return new references. Code that accidentally worked in previous versions due to hidden reference counting bugs may now crash.fixReview Objective-C object initialization patterns in your PyObjC code, especially those involving `alloc().init...()`. Ensure correct reference handling, as PyObjC now more strictly enforces ARC semantics.
affects: 11.1+
gotchaThere was a breaking change in PyObjC 10.3 regarding the interaction of `__init__` and `__new__` in Python subclasses of Objective-C classes. While 10.3.1 partially reverted this, user-defined `__init__` methods on classes with a user-defined `__new__` will work, but `__init__` cannot be used with the `__new__` provided by PyObjC.fixAvoid using `__init__` in conjunction with the default `__new__` provided by PyObjC for Objective-C classes. If you need custom initialization logic, consider using Objective-C compatible initializer methods (e.g., `initWith...`).
affects: 10.3 - 10.3.1
deprecatedPyObjC frameworks are direct wrappers of Apple's Objective-C frameworks. If Apple deprecates or removes an underlying framework (e.g., IMServicePlugIn removed in macOS 14), its PyObjC bindings will also be removed in future PyObjC versions without specific deprecation cycles within PyObjC itself.fixConsult Apple's developer documentation for the OSLog framework and the macOS version your application targets to ensure continued API availability and best practices.
affects: All versions (future impact)
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredRequired core bridge for all PyObjC framework wrappers.
pythonrequiredRequires Python 3.10 or later.