PyObjC#
PyObjC provides bindings to most Objective-C frameworks on macOS, build upon a generic bidirectional bridge between Python and Objective-C.
PyObjC aims to get as close as possible to having Python and a first class language for developing applications and scripts on macOS using Apple’s high level system APIs.
Cocoa class definition in Python#
from Foundation import NSObject
from objc import super
class MyCocoaObject(NSObject):
def initWithX_y_(self, x, y):
self = super().init()
if self is None:
return None
self.x = x
self.y = y
return self
Cocoa class definition in Objective-C#
#import <Foundation/Foundation.h>
@interfae MyCocoaObject : NSObject {
int x, y;
}
-(instancetype)initWithX:(int)x y:(int)y;
@end
@implementation MyCocoaObject
-(instancetype)initWithX:(int)xValue y:(int)yValue
{
self = [super init];
if (!self) return nil;
x = xValue;
y = yValue;
return self;
}
Release Info
PyObjC 12.2.2 was released on 2026-08-11. See the changelog for more information.
Supported Platforms
macOS 10.9 and later
Python 3.10 and later
x86_64 and arm64
Installing PyObjC
$ python3 -mpip \
install -U pyobjc
Technical Notes
- Free-threading support
- Instantiating Objective-C objects
- Using
super() - Exceptions in Cocoa code
- Support for
FSRef - PyObjC protocol support
- PyObjC support for “blocks”
- Integration with ctypes
- Key-Value Observing and Python
- Object-graph serialization
- Code Signing and Notarizing
- Dealing with API deprecations