PyObjC is the way to go:

#!/usr/bin/python

from AppKit import NSPasteboard, NSStringPboardType

pb = NSPasteboard.generalPasteboard()
pbstring = pb.stringForType_(NSStringPboardType)
print u"Pastboard string: %s".encode("utf-8") % repr(pbstring)

This only supports text and will return None otherwise. You can extend it to support other data types as well, see NSPastboard Class Reference.

Answer from MagerValp on Stack Overflow
🌐
PyPI
pypi.org › project › clipboard
clipboard · PyPI
A cross platform clipboard operation library of Python. Works for Windows, Mac and Linux.
      » pip install clipboard
    
Published   May 22, 2014
Version   0.0.4
Discussions

Copy to system clipboard
I’m working on a an app (my 2nd GUI app) that generates a hash value (AKA: checksum) based on a selected file. Right now, the hash value is displayed in a Text Widget, which is has the ‘state’ set to ‘disabled’, so that said value can’t be messed with. More on discuss.python.org
🌐 discuss.python.org
5
0
June 2, 2022
macos - Can python send text to the Mac clipboard - Stack Overflow
I'd like my python program to place some text in the Mac clipboard. Is this possible? More on stackoverflow.com
🌐 stackoverflow.com
copykitten: the missing clipboard library for Python
“Now I hate windows” 😂🤣 same. I grew up using only Windows machines, never knowing how green the grass can be with other options. More on reddit.com
🌐 r/Python
35
120
February 21, 2024
macOS tkinter clipboard only works once
Any subsequent press of the button ... the clipboard never updates. Closing and restarting the example resets the problem. This appears to be a macOS specific bug as I have tested on windows 10 and Linux mint in a virtual box, both work as expected with me able to paste a new time on each subsequent button press. On Mac I have tested Python 3.10 & 3.11 ... More on github.com
🌐 github.com
12
May 18, 2023
🌐
Macdrifter
macdrifter.com › 2011 › 12 › python-and-the-mac-clipboard.html
Python and the Mac Clipboard - Macdrifter
December 2, 2011 - PyObjC is a Python library for accessing the Objective C frameworks in Python. It should provide a native mechanism for accessing the OS X clipboard and provide additional features not available through the subprocess methods above. After some reading and fiddling[1], I ended up with a version of the above script that uses the NSPasteboard class to get and set the clipboard instead of a using the shell command.
🌐
PyPI
pypi.org › project › pasteboard
pasteboard
JavaScript is disabled in your browser. Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
Python.org
discuss.python.org › python help
Copy to system clipboard - Python Help - Discussions on Python.org
June 2, 2022 - I’m working on a an app (my 2nd GUI app) that generates a hash value (AKA: checksum) based on a selected file. Right now, the hash value is displayed in a Text Widget, which is has the ‘state’ set to ‘disabled’, so that …
Find elsewhere
🌐
The Building Coder
thebuildingcoder.typepad.com › blog › 2013 › 06 › python-mac-pasteboard-access.html
Python Mac Pasteboard Access - The Building Coder - TypePad
June 2, 2013 - Thanks to the platform independence provided by Python, the only thing that needs changing is to replace the Windows clipboard access by Mac pasteboard read and write operations.
🌐
ActiveState
code.activestate.com › recipes › 410615-manipulate-mac-os-clipboard
Manipulate Mac OS clipboard « Python recipes « ActiveState Code
April 20, 2005 - It can double as a Unix-style command-line tool that prints the clipboard contents to stdout or, if specified, copies its stdin to the clipboard, although pbcopy(1) and pbpaste(1) are better suited for that. ... By default, the most reasonable choice of the 'TEXT' flavour is used. Other flavors for special uses can be specified. If there is no "scrap" of a given flavor, Mac OS API report this as an error.
🌐
PyPI
pypi.org › project › pyperclip
pyperclip · PyPI
It works with Python 2 and 3. ... ... Windows, no additional modules are needed. On Mac, this module makes use of the pbcopy and pbpaste commands, which should come with the os....
      » pip install pyperclip
    
Published   Sep 26, 2025
Version   1.11.0
🌐
GitHub
github.com › terryyin › clipboard
GitHub - terryyin/clipboard: A cross platform clipboard operation library of Python. Works for Windows, Mac and Linux.
A cross platform clipboard operation library of Python. Works for Windows, Mac and Linux. - terryyin/clipboard
Starred by 89 users
Forked by 6 users
Languages   Python 86.7% | Makefile 13.3% | Python 86.7% | Makefile 13.3%
🌐
Reddit
reddit.com › r/python › copykitten: the missing clipboard library for python
r/Python on Reddit: copykitten: the missing clipboard library for Python
February 21, 2024 -

What My Project Does

copykitten is a clipboard library with support for text and images and a simple API. It's built around Rust arboard library. Thanks to this, it's multiplatform and doesn't require any dependencies.

Target Audience

Developers building CLI/GUI/TUI applications. The library has beta status on PyPI, but the underlying Rust library is pretty stable, being used in commercial projects like Bitwarden and 1Password.

Comparison

There are lots of other clipboard libraries for Python: pyperclip, jaraco.clipboard, pyclip, just to name a few. However, most of them are not maintained for years and require the presence of additional libraries or tools in the operating system. copykitten doesn't suffer from these shortcomings.

A bit of history

Throughout my years with Python there were several times when I needed to use the clipboard in my applications and every time I had to fall back to some shaky methods like asking the end user to install xclip and calling subprocess.run. This never felt great.

Right now I'm making a multiplayer TUI game (maybe I’ll showcase it later too :) ), where users can copy join game codes into the clipboard to easily share it (much like Among Us). This is how I came to the idea of making such a library. I also wanted to try Rust for a long time, and so this all just clicked in my head instantly.

I had fun building it and definitely had some pain too and learned a bit of nitty-gritty details about how clipboards work in different operating systems. Now I hate Windows.

With this post I hope to gain some attention to the project so that I can receive feedback about the issues and maybe feature requests and spread the word that there's a modern, convenient alternative to the existing packages.

Feel free to try it out: https://github.com/Klavionik/copykitten

🌐
Readthedocs
pyperclip.readthedocs.io › en › latest
Welcome to Pyperclip’s documentation! — Pyperclip 1.5 documentation
Pyperclip provides a cross-platform Python module for copying and pasting text to the clipboard.
🌐
AskPython
askpython.com › home › how do i read text from the clipboard?
How do I read text from the clipboard? - AskPython
February 27, 2023 - pyperclip is a Python module that provides a simple and cross-platform way to access the clipboard in order to read or write text content. It allows developers to easily copy and paste text between different applications or within the same ...
🌐
Medium
medium.com › analytics-vidhya › clipboard-operations-in-python-3cf2b3bd998c
Clipboard operations in python.. It is very easy to perform copy/paste… | by Keerti Prajapati | Analytics Vidhya | Medium
January 22, 2024 - Let’s first have a look into the dependencies of pyperclip required in different OS. On Windows, no additional modules are needed. On Mac, the pyobjc module is used, falling back to the pbcopy and pbpaste cli commands.
🌐
AskPython
askpython.com › home › how to read text from a clipboard using read_clipboard?
How to Read Text From a Clipboard Using read_clipboard? - AskPython
February 16, 2023 - The clipboard can be viewed in Finder->Edit->Show Clipboard. ... Pandas is a python library that is used to work with datasets.
🌐
GitHub
github.com › python › cpython › issues › 104613
macOS tkinter clipboard only works once · Issue #104613 · python/cpython
May 18, 2023 - When attempting to copy to the clipboard on macOS I can get it to work once and only once. Here's a bare miniumum example to illustrate the issue import tkinter as tk import datetime def on_click(): root.clipboard_clear() now = datetime....
Published   May 18, 2023
Author   Goldthing
🌐
Delft Stack
delftstack.com › home › howto › python › python copy to clipboard
How to Copy Text to Clipboard in Python | Delft Stack
February 12, 2024 - The pyperclip module is a versatile library that enables seamless cross-platform clipboard interactions in Python. It works on various operating systems, including Windows, Linux, and macOS.