Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to Install pyperclip in Python on MacOS?

  • Last Updated : 26 Oct, 2021

In this article, we will learn how to install pyperclip in Python on MacOS. 

Pyperclip is a cross-platform Python module for copy and paste clipboard functions. It works with both Python 2 and 3. This module was created to enable cross-platform copy-pasting in Python which was earlier absent. The pyperclip module has copy() and paste() functions that can send a text to and receive a text from your computer’s clipboard.

Installing pyperclip on MacOS:

Method 1: Using pip to install pyperclip Package

Follow the below steps to install the pyperclip package on macOS using pip:

Step 1: Install the latest Python3 in MacOS

Step 2: Check if pip3 and python3 are correctly installed.

python3 --version
pip3 --version

checking python and pip version in macos

Step 3: Upgrade your pip to avoid errors during installation.

pip3 install --upgrade pip

upgrading pip in macos

Step 4: Enter the following command to install pyperclip using pip3.

pip3 install pyperclip

installing pyperclip package on macOS using pip

Method 2: Using setup.py to install pyperclip

Follow the below steps to install the pyperclip pyperclip on macOS using the setup.py file:

Step 1: Download the latest source package of pyperclip for python3 from here.

curl https://files.pythonhosted.org/packages/a7/2c/4c64579f847bd5d539803c8b909e54ba087a79d01bb3aba433a95879a6c5/pyperclip-1.8.2.tar.gz > pyperclip.tar.gz

downloading the source package for pyperclip in macos

Step 2: Extract the downloaded package using the following command.

tar -xzvf pyperclip.tar.gz

extracting the pyperclip.tar.gz file in macos

Step 3: Go inside the folder and Enter the following command to install the package.

Note: You must have developer tools for XCode MacOS installed in your system

cd pyperclip-1.8.2
python3 setup.py install

installing pyperclip on macOS using the setup.py file

Verifying pyperclip installation on macOS:

Make the following import in your python terminal to verify if the installation has been done properly:

import pyperclip

Verifying pyperclip installation on macOS

If there is any error while importing the module then is not installed properly.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!