Skip to content
An Elixir package to copy and paste from system clipboard
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Fix default configuration Jul 7, 2017
lib Set output width to infinity Oct 12, 2017
.gitignore Unleash the 🐙! Jul 6, 2017 Add Oct 12, 2017 Unleash the 🐙! Jul 6, 2017 Improve example in Oct 12, 2017
mix.lock Update dependencies Oct 12, 2017


Copy and paste from system clipboard.

Sick of IO.puts(json) then manually selecting your terminal? Try Clipboard.copy(json)!

Wraps ports to system-specific utilities responsible for clipboard access. It uses the default clipboard utilities on macOS, Linux and Windows but can be configured to call any executable.


Clipboard.copy("Hello, World!") # Copied to clipboard

"Hello, World!"
|> Clipboard.copy() # Insert into pipelines
|> business_as_usual()

# And paste too!
greeting = Clipboard.paste()


Clipboard uses these utilities by default.

OS Utilities
macOS pbcopy & pbpaste
Linux xclip
Windows clip

However, you can instruct Clipboard to use another command by setting config.exs.

config :clipboard,
  unix: [
    copy: {"xsel", ["-i"]},
    paste: {"xsel", ["-o"]},

Supported operating systems are :macos, :unix and :windows.


Add clipboard to your list of dependencies in mix.exs:

def deps do
  [{:clipboard, ">= 0.0.0", only: [:dev]}]

Don’t forget to update your dependencies.

$ mix deps.get


Pasting on Windows doesn’t work out of the box because clip only supports copying.



Clipboard is released under MIT license.

You can’t perform that action at this time.