Tag Archives: os x

pbpaste & pbcopy in Mac OS X (or: Terminal + Clipboard = Fun!)

The OS X shell is very powerful, but some wonderfully useful commands are almost entirely unknown to the community at large. Two of these forgotten commands are pbcopy and pbpaste. Let’s take a quick look at what they can do.

pbcopy

This command allows you to copy text from stdin into the clipboard1 buffer. Trivial example:

echo 'Hello World!' | pbcopy

“Hello World!” is now in your clipboard.

pbpaste

Pastes from your clipboard to stdout. Trivial example:

echo `pbpaste`

This will echo the contents of your clipboard. If you’re following along you’ll see “Hello World!”.

What Can I Do With These?

What can’t you do! Oh, you want examples? Well…

  • You could grab the output of a grep/awk/sed to paste into IM/IRC.
  • You could use a macro tool (like iKey, QS, et cetera) to create text modifying workflows that grab highlighted text, manipulate it, and replace it inline.
  • You could pull changelogs from svn into the clipboard when tagging for release so you could email them to coworkers.

Let me know what amazing things you come up with to enhance your own productivity!

  1. or pasteboard, hence the prefix “pb”

NTFS-3G 64-bit PrefPane For Snow Leopard

Update: A version of NTFS-3G with native 64-bit PrefPane support has been released. The instructions below have been left for archival purposes, but are no longer required.

I use NTFS-3G + MacFUSE to write to NTFS disks on occasion, but I hate restarting System Preferences just to run a 32-bit PrefPane when I want to view/change some settings. Behold the power of open source!

To compile a 64-bit System Preferences compatible version of this item simply

  1. Grab the source for the NTFS-3G PrefPane
  2. Right click and get info on the build target to add x86_64, turn on Objective-C garbage collection to “supported”1
  3. Build the target.

…and you’re all set. You can download my copy, but I don’t recommend using it in 10.5 or 10.4. Of course, you don’t need a 64-bit PrefPane prior to 10.6 so why would you download it anyway?

  1. If you set it to supported it should work in OS X 10.5 still