In a previous article, I covered creating, starting, and stopping iOS simulations. macOS comes with a handy tool to interact with the clipboard (aka pasteboard) on a Mac called pbcopy. You can redirect information from a file into your clipboard using the pbcopy command. Here, we’ll simply call pbcopy and then a file path pbcopy ~/Desktop/transfer.txt You can then redirect your text into simctl by doing a pbpaste into xcrun simctl pbpaste booted Once you’ve copied your data, clean up the transfer file: rm ~/Desktop/transfer.txt You can also pull text out. If you write data into the clipboard (e.g. during instrumentation) then you can extract it from that pasteboard using…
-
-
Shell to Clipboard & Back Again
Many times I want to send data straight into the clipboard from a command or script and I don’t really want to have to mess with manually lasso’ing text, using Command-C, etc. What can I say, I’m kinda’ lazy (or working too much, not really sure which). Apple has been kind enough to supply us with a pair of really useful tools for interfacing with the clipboard (er, pasteboard) in Mac OS X: pbcopy and pbpaste. To use pbcopy, which copies text into the pasteboard, simply pipe data to it. For example, if you want to send a directory listing that you run in a script into the pasteboard, you…