Ruby pbcopy and pbpaste
pbcopy and pbcopy are two handy Mac OS X command line utilities to copy and paste content to the Clipboard.
The following Ruby methods provides access to the same utility using Ruby.
def pbcopy(input)
  str = input.to_s
  IO.popen('pbcopy', 'w') { |f| f << str }
  str
end
def pbpaste
  `pbpaste`
endTo make them available in IRB, add them to your ~/.irbrc file.
Written by Simone Carletti
Related protips
1 Response
 
This doesn't seem to work for me. Is there anything special you need to do for mavericks? Thanks!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Shell 
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#

 
 
 
 
