Copy-to-clipboard and downloadhandler not working when Shiny App deployed on Ubuntu server


I developed my Shiny apps in Windows. All features (including copy-to-clipboard and download buttons) work as expected.

However, when I deploy it in our Shiny Server (ubuntu), the copy-to-clipboard and download buttons fail.

Thanks very much for your help!

shiny::observeEvent(input$copy_cross, {
clipr::write_clip(eval(parse(text = "x =[,1],sel()[,2]))")), row.names= T, col.names = NA)

output$download_cross <- shiny::downloadHandler(
  filename = function() {paste("Crosstabs (Counts).xlsx")},
  content  = function(file) {
    openxlsx::write.xlsx(x =[,1],sel()[,2])), file, sheetName = "Crosstabs", row.names= T, col.names = T, append=F)


You need to install a linux utility which can copy to the clipboard like xclip to get clipr to work.


Simple utility functions to read and write from the system clipboards of Windows, OS X, and Unix-like systems (which require either xclip or xsel.)

quoted from the clipr description in:

With xclip installed on your linux system, your code should run without any change to it.