0.0
The project is in a healthy, maintained state
Provides a global pbcopy function to copy text to the system clipboard using the macOS pbcopy command
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 5.0
~> 13.0
 Project Readme

pbcopy-ruby

A simple Ruby gem that makes a global pbcopy function available to copy text to the system clipboard.

Installation

Add this line to your application's Gemfile:

gem 'pbcopy-ruby'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install pbcopy-ruby

Usage

After installing the gem, you can use the pbcopy function anywhere in your Ruby code:

require 'pbcopy-ruby'

# Copy a string to clipboard
pbcopy("Hello, clipboard!")

# Also works with other objects that respond to to_s
pbcopy(123)
pbcopy([:a, :b, :c])

# You can chain it in expressions as it returns the input
puts pbcopy("This text is copied and printed")

Note

This gem requires the pbcopy command, which is available by default on macOS. It will not work on other operating systems without additional configuration.

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub.

License

The gem is available as open source under the terms of the MIT License.