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 › 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
Discussions

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
Copy an image to MacOS clipboard using python - Stack Overflow
Most of python clipboard modules like pyclip or clipboard doesn't support images. I found a code that does that on windows, but nothing for mac. I tried to use QT, installed it through brew, for some reason brew installed a new python 3.7.2 (I had 3.7.1) and messed up with terminal commands like python and python3. I managed to fix it, but it's very frustrating. And I couldn't get ... More on stackoverflow.com
🌐 stackoverflow.com
How do I read text from the Windows clipboard in Python? - Stack Overflow
Yes it should work on Python 3.6, and I just tested with Python 3.7.4 (64-bit). Looking the setup.py of the package it should have no dependencies to Pyside or any other packages. Are you sure that the paste command is trying to use Pyside? 2020-03-30T08:03:06.157Z+00:00 ... I used pip to install clipboard package which only has one line from pyperclip import copy, paste LOL. pyperclib is the perfect solution. 2021-01-09T09:07:21.45Z+00:00 ... pyperclip also works on Mac ... More on stackoverflow.com
🌐 stackoverflow.com
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
🌐
PyPI
pypi.org › project › clipboard
clipboard · PyPI
Works for Windows, Mac and Linux. Well, as I was trying to implement this, I realize that everything is included in pyperclip already: https://pypi.python.org/pypi/pyperclip/ But anyway, clipboard is a better name. You are free to choose:-) I might add more features to it. ... import clipboard clipboard.copy("abc") # now the clipboard content will be string "abc" text = clipboard.paste() # text will have the content of clipboard ... Download the file for your platform.
      » pip install clipboard
    
Published   May 22, 2014
Version   0.0.4
🌐
Macdrifter
macdrifter.com › 2011 › 12 › python-and-the-mac-clipboard.html
Python and the Mac Clipboard - Macdrifter
December 2, 2011 - 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. :::Python import urllib2 from Foundation import * from AppKit import # Sets the clipboard to a string def pbcopy(s): pb = NSPasteboard.generalPasteboard() pb.declareTypes_owner_([NSStringPboardType], None) newStr = NSString.stringWithString_(s) newData = newStr.nsstring().dataUsingEncoding_(NSUTF8StringEncoding) pb.setData_forType_(newData, NSStringPboardType) # Gets the clipboard contents def pbpaste(): pb = NSPasteboard.generalPasteboard() content = pb.stringForType_(NSStringPboardType) return content f = urllib2.urlopen(pbpaste()) source = f.read() f.close() newurl = f.geturl() newurl = newurl.split('?')[0] pbcopy(newurl)
🌐
PyPI
pypi.org › project › pyperclip
pyperclip · PyPI
Otherwise run "sudo apt-get install xclip" or "sudo apt-get install xsel" (Note: xsel does not always seem to work.) Otherwise on Linux, you will need the qtpy or PyQT5 modules installed.
      » pip install pyperclip
    
Published   Sep 26, 2025
Version   1.11.0
🌐
GitHub
gist.github.com › luqmaan › d8bc61e746207bb12f11
Write a python string to the clipboard via pbcopy (OS X) · GitHub
Download ZIP · Write a python string to the clipboard via pbcopy (OS X) Raw · write_to_clipboard.py · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Find elsewhere
🌐
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%
🌐
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.
🌐
GitHub
github.com › asweigart › pyperclip
GitHub - asweigart/pyperclip: Python module for cross-platform clipboard functions. · GitHub
Pyperclip is a cross-platform Python module for copy and paste clipboard functions. It works with Python 2 and 3. Install on Windows: pip install pyperclip · Install on Linux/macOS: pip3 install pyperclip · Al Sweigart al@inventwithpython.com BSD License ·
Starred by 1.8K users
Forked by 222 users
Languages   Python
🌐
ActiveState
code.activestate.com › recipes › 410615-manipulate-mac-os-clipboard
Manipulate Mac OS clipboard « Python recipes « ActiveState Code
April 20, 2005 - This will no longer work in current MacOSX versions, as born out by the documentation: https://docs.python.org/2/library/carbon.html#module-Carbon.Scrap
🌐
GeeksforGeeks
geeksforgeeks.org › installation guide › how-to-install-pyperclip-in-python-on-macos
How to Install pyperclip in Python on MacOS? - GeeksforGeeks
July 23, 2025 - ... Step 3: Upgrade your pip to avoid errors during installation. ... Step 4: Enter the following command to install pyperclip using pip3. ... Step 1: Download the latest source package of pyperclip for python3 from here.
🌐
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.
🌐
PyPI
pypi.org › project › pyperclip3
pyperclip3 · PyPI
February 1, 2021 - Cross-platform clipboard utilities supporting both binary and text data.
      » pip install pyperclip3
    
Published   Feb 01, 2021
Version   0.4.1
🌐
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 …
🌐
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