Questions tagged [pbcopy]
32 questions
30
votes
3 answers
How might I pass text data from the ruby console into my clipboard without saving to a file?
I'm trying to pass the array contained in a global variable I've created into my clipboard on my mac.
It is very long so I don't want to highlight, copy & paste on my console.
I want to use embedded unix code, specificially the pbcopy function for…

boulder_ruby
- 38,457
- 9
- 79
- 100
15
votes
5 answers
Set clipboard to image - pbcopy
How do you set an image as the clipboard with pbcopy?
This doesn't work:
cat image.png | pbcopy

Tyilo
- 28,998
- 40
- 113
- 198
11
votes
2 answers
How do I use pbcopy in a bash function? Can it be scripted?
I often find myself copying history commands to my clipboard using this:
echo !123 | pbcopy
This works fine from the Terminal. Assuming !123 = cd .., it looks something like this:
$ echo !123 | pbcopy
echo cd .. | pbcopy
//result: `cd ..` is in…

JP Lew
- 4,121
- 2
- 32
- 45
8
votes
2 answers
How can I copy the output of the last executed command directly into my clipboard?
I have seen this post: how-can-i-copy-the-output-of-a-command-directly-into-my-clipboard
I have got this alias
# Redoes the last command and copies the output to clipboard
alias cl="fc -e -|pbcopy"
However I would like an alias or a function…

dimitrieh
- 401
- 3
- 17
5
votes
4 answers
GIT - how do I copy SHA without mouse on OSX?
On OSX, often I go to the git log in order to find a commit, usually a few back, copy it with my mouse, then rebase off of that.
How can I do this easily without using my mouse or memorizing it?

wejrowski
- 439
- 5
- 20
5
votes
2 answers
Send echo or register contents to pbcopy / mac clipboard on mac os x
I have a custom function in vimscript which creates a string and then echo's it to the bottom console. At the moment I copy and paste that output using cmd-c to copy it to the mac os x clipboard. I would like to shorten this workflow by just…
user856590
3
votes
4 answers
Unable to have pbcopy -clipboard inside Screen
Problem Not solved although one answer was accepted: We are working to get Jonah's code to work.
Problem: to change the code of (1) to (2)
I know the thread. I want to be able to run the following code inside Screen
Code (1)
cat ~/.vimrc | pbcopy …

Léo Léopold Hertz 준영
- 134,464
- 179
- 445
- 697
2
votes
2 answers
R - pipe("pbcopy") columns not lining up with pasting
As a follow-up to a question I wrote a few days ago, I finally figured out how to copy to the clipboard to paste into other applications (read: Excel).
However, when using the function to copy and paste, the variable column headers are not lining…

mikebmassey
- 8,354
- 26
- 70
- 95
2
votes
1 answer
How can I input the correct encoding to pbcopy in node.js?
const proc = require('child_process').spawn('pbcopy');
const iconv = require('iconv-lite');
const name = '吉星高照';
function iconvDecode(str = '') {
return iconv.decode(Buffer.from(str, 'binary'), 'cp936');
}
function pbcopy(data) {
…

Aero Wang
- 8,382
- 14
- 63
- 99
2
votes
1 answer
Unix: command to strip white space characters
When I do the following unix command:
pwd | pbcopy
is there something I can add to the command so that the string copied to my clipboard does not have any trailing whitespace?
(fyi: The reason I ask is because when I pipe the output to pbcopy, it…

well actually
- 11,810
- 19
- 52
- 70
1
vote
2 answers
Unable to pbcopy at Vim's ED editor
I have tried unsuccessfully to copy the pwd to pbcopy as follows
pwd | !pbcopy
How can you copy your path in Vim's ED editor (: -mode)?

Léo Léopold Hertz 준영
- 134,464
- 179
- 445
- 697
1
vote
0 answers
How to find PBC pair?
I am using PBC library for cryptographic operations writing in C++ and I am stack in finding how to put two element like
C = (g^r , H(X))
.
For pairing operation, for eg:
e(g^r , H(X))
can be used with element_pairing(pp, g^r, H(X))
But for…

Htet
- 11
- 1
1
vote
1 answer
Unable to save pbcopy to a new file without opening a text-editor
I tried the following code unsuccessfully
cat pbcopy >> newFile
How can you save your clipboard to the file newFile without opening a text-editor?

Léo Léopold Hertz 준영
- 134,464
- 179
- 445
- 697
1
vote
0 answers
macOS: Using pbcopy from PHP does not work
On macOS there is a terminal utility called 'pbcopy' which copies text into the clipboard.
pbcopy < file copies the contents of 'file' into the clipboard.
But from PHP (running under Apache, both the standard PHP and Apache included in macOS) it…

web site maker
- 109
- 7
1
vote
1 answer
How to use NSTask with pbcopy?
I am a beginner and I have a problem. I would like to use NSTask with the command "pbcopy". I tried this but it seems that it doesn't work :
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/bin/echo"];
NSArray…

Zandoo
- 45
- 3