title: How can I copy text to the clipboard from a Mono/C# console application on OS X?
body: <p>I'm writing a console app in C#, using Mono on OS X. </p>
  
  <p>On Windows, here is how I copy text to the clipboard:</p>
  
  <pre><code>Clipboard.SetText("text");
  </code></pre>
  
  <p>...from a method marked up with the STAThread attribute:</p>
  
  <pre><code>[STAThread] // for OLE
  public static void Main (string[] args)
  {
      Clipboard.SetText("text");
  }
  </code></pre>
  
  <p>Clipboard is defined in System.Windows.Forms. That code compiles and runs both under the official Microsoft .NET runtime on Windows <em>and</em> on the the Mono runtime on OS X.  </p>
  
  <p>On Windows, the text gets copied, so it's not an issue of forgetting a reference or a using statement.</p>
  
  <p>Unfortunately, when I run the code under Mono/OS X, the text isn't actually copied to the Clipboard. Something appears quickly on my Dock and then disappears just as quickly, but either way, the text I'm trying to copy doesn't end up on the clipboard.</p>
  
  <p>So: how do I copy text do the clipboard on OS X (and Linux?) using Mono?</p>
  
  <p>If you're interested in seeing the entire project, the code is here: <a href="https://github.com/leeohsheeus/boom-sharp" rel="nofollow">https://github.com/leeohsheeus/boom-sharp</a>.</p>