Wrapping the `CopyToClipboard[]` in a `UsingFrontEnd[]` allows us to use it scripts: #!/usr/bin/env wolframscript string = "Pshhhkkkkkrrrrkakingkakingkakingtshchchchchchchchchdingdingding"; UsingFrontEnd[CopyToClipboard[string]];