Skip to main content

A basic, ctypes-based Python binding to the macOS Objective-C Cocoa runtime and several other macOS libraries.

This is package cocoa-python by Phillip Nguyen (C) 2011, modified, extended, tested, documented and published with permission under both the MIT License and the original New BSD License.

Installation

To install pycocoa, type pip install pycocoa or easy_install pycocoa in a terminal window. Alternatively, download pycocoa-y.m.d.zip from PyPI or GitHub, unzip the downloaded file, cd to directory pycocoa-y.m.d and type python setup.py install. To run all PyCocoa tests, type python setup.py test or python test/run.py before or after installation.

Examples cocoavlc.py and simple_VLCplayer.py require installation of the VLC App and the corresponding Python-VLC binding.

Documentation

In addition to the pycocoa package, the distribution files contain several tests, some examples and the documentation (generated by Epydoc using command line epydoc --html --no-private --no-source --name=pycocoa --url=... -v pycocoa).

Tests

The tests and examples have only been run with 64-bit Python 3.14, 3.13.4, 3.12.7 and 2.7.18 using Python-VLC 3.0.21, 3.0.18, 3.0.16, 3.0.12, 3.0.11, 3.0.10, 3.0.8, 3.0.6, 3.0.4 and 2.2.8 (with the compatible VLC App) on maxOS 26.1 Tahoe, macOS 15.5 Sequoia, 14.7.3 Sonoma, 13.2 Ventura, 12.0.1 Monterey, 11.6.1 and 11.5.2 Big Sur (aka 10.16), 10.15.7 Catalina, 10.14.6 Mojave or 10.13.6 High Sierra. The tests run with and without lazy import in Python 3.

Python 3.14, 3.13.4 and 3.12.7 run on Apple M4 Si (arm64 natively), other Python versions run on Intel (x86_64) or Intel emulation (arm64_x86_64, see function pycocoa.machine), but only before macOS 15 Sequoia (see function pycocoa.segfaulty).

Previously, pycocoa was tested with 64-bit Python 3.11.5, 3.10.0, 3.9.6, 3.8.1-6, 3.7.4-6, 3.6.5, 2.7.17 and macOS' 2.7.16. However, pycocoa has not been tested on iOS nor with 32-bit Python and does not work with PyPy nor with Intel(R) Python.

Notes

All pycocoa source code has been statically checked with Ruff using Python 3.13.9 and with PyChecker, PyFlakes, PyCodeStyle (formerly Pep8) and McCabe using Python 2.7.18, both in 64-bit on macOS 26.1 Tahoe.

Some alternatives to pycocoa are (a) PyObjC, the most comprehensive Python to Objective-C bridge (no longer included in macOS' Python), (b) Rubicon-ObjC for Python 3.5+, taking advantage of Python's typing annotations, (c) PyGUI for macOS and (d) wxPython.

Last updated: Dec 04, 2025.

Licenses

Copyright (C) 2017-2026 -- mrJean1 at Gmail -- All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (C) 2011 -- Phillip Nguyen -- All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of objective-ctypes nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

https://Img.Shields.io/pypi/pyversions/PyCocoa.svg?label=Python https://Img.Shields.io/pypi/v/PyCocoa.svg?label=PyPI https://Img.Shields.io/pypi/wheel/PyCocoa.svg https://Img.Shields.io/pypi/l/PyCocoa.svg https://img.shields.io/pypi/dm/pycocoa

Metadata

Release files for pycocoa 25.12.4

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

Source distribution (sdist)

Source distribution for pycocoa 25.12.4
File Size Uploaded
pycocoa-25.12.4.tar.gz 558.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pycocoa 25.12.4
File Interpreter ABI Platform
pycocoa-25.12.4-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 785.7 kB

Release files / pycocoa-25.12.4.tar.gz

Download URL pycocoa-25.12.4.tar.gz
Size 558.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6b174e972da63657ddf1095e6504e4cad63e143046752b71aa496e14e8f27722
BLAKE2b-256 checksum
How to use checksums
d2f74d61927a6be0ce33129b35221751c844e925619f199567517dbf10377ba1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release files / pycocoa-25.12.4-py2.py3-none-any.whl

Download URL pycocoa-25.12.4-py2.py3-none-any.whl
Size 227.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
189f08be6f3b479bad53711776eec5687a9eddc30e88c1ac24ed458e6053ba1b
BLAKE2b-256 checksum
How to use checksums
58f60b1b50967c878eae9c84b68dc098ee004cabf57d0d7a449001ddf04b8aaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release history Release notifications | RSS feed

This release

25.12.4 This release

2 release files

18.8.9

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