xclip icon indicating copy to clipboard operation
xclip copied to clipboard

Does anyone use xclip successfuly on Mac? How?

Open alexaandru opened this issue 6 years ago • 9 comments

Trying to use xclip to paste html into Gmail. Works flawlessly on Linux, doesn't work at all on Mac. No error, so I guess it makes it to X11's clipboard but when trying to paste into the browser nothing happens.

I understand that X11's clipboard and Mac's clipboard are different (which makes sense). Is there any way to cross that barrier? Oh, I am using XA_CLIPBOARD to store the text.

Thank you!

alexaandru avatar Feb 04 '19 17:02 alexaandru

Hello everyone,

I am having an issue with mac as well. pbcopy & pbpaste aliases works well when using only the terminal.

But when I try, for example, pbcopy something and then command+v somewhere, it doesn't work as I would like.

I don't know if I am missing some step to do locally.

alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'

I am using xclip 0.13 installed from brew & XQuartz 2.7.11

Best,

lerox avatar Oct 10 '19 16:10 lerox

If the copy is working within XQuartz but not being sent outside of it to MacOS, then the problem is likely with an XQuartz setting. Look in the menus and see if you can find a option that says something like, "Copy X clipboard to System", or "Synchronize Clipboards". If there isn't one, then it's possible XQuartz simply cannot do that.

hackerb9 avatar Oct 12 '19 10:10 hackerb9

@alexaandru Did you ever get this figured out?

hackerb9 avatar Nov 02 '20 06:11 hackerb9

i think $DISPLAY has to be defined.

chovyprognos avatar Apr 28 '21 21:04 chovyprognos

You can use pbcopy or pbpaste in mac I think

diogoquaresma avatar Mar 14 '22 10:03 diogoquaresma

curl: (22) The requested URL returned error: 404

$ brew install xclip
==> Downloading https://formulae.brew.sh/api/formula.jws.json
curl: (22) The requested URL returned error: 404                              

Error: Failure while executing; `/usr/bin/env /usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --user-agent Homebrew/4.0.10\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 13.1\)\ curl/7.85.0 --header Accept-Language:\ en --fail --progress-bar --location --remote-time --output /Users/xgqfrms-mm/Library/Caches/Homebrew/api/formula.jws.json --compressed --speed-limit 100 --speed-time 5 --progress-bar https://formulae.brew.sh/api/formula.jws.json` exited with 22. Here's the output:
curl: (22) The requested URL returned error: 404                              

xgqfrms avatar Apr 16 '23 03:04 xgqfrms

still working?

yashkumarverma-fampay avatar Jul 11 '23 21:07 yashkumarverma-fampay

@yashkumarverma-fampay I recommend using pbcopy on macOS, that is a better solution.

poloxue avatar Oct 28 '23 08:10 poloxue

I am having the same issue with tmux and vi mode.

This was my default config using xclip

# Copy to clipboard on 'y'ank
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'

# Copy to clipboard on mouse release
bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'

I have also tried the reattach-to-user-namespace wrapper.

# Wrapper to allow copy-paste to clipboard on OSX
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
set-option -g default-command "reattach-to-user-namespace -l zsh"

# Copy to clipboard on 'y'ank
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'

# Copy to clipboard on mouse release
bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'

It doesn't really matter whether I have the copyOnSelect option set to true, in this instance. Same for set -g set-clipboard on.

Note that my default config works fine in Warp (though some other things do not, which is why I switched to Hyper).

Any ideas?


  • References: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard

davelsan avatar Oct 31 '23 09:10 davelsan