title: Write Cookie Programmatically to Safari
body: <p><strong>Requirement:</strong></p>
  
  <p>On a Mac, write a cookie in Safari to a particular domain on startup.</p>
  
  <p>So far the options I can think of are.</p>
  
  <p><strong>1. Safari's cookie file</strong></p>
  
  <p>On startup, write the cookie directly to Safari's binary file located in <code>~/Library/Cookies/Cookies.binarycookies</code>. However, I don't know if this is possible and cannot find any documentation on it. I'm reluctant to try this incase the file has a checksum against it.</p>
  
  <p><strong>2. Get Safari to set it</strong></p>
  
  <p>On startup, using AppleScript, launch Safari silently/hidden and navigate to a site which sets the cookie.</p>
  
  <ul>
  <li>Are there any other ways I could do this? </li>
  <li>How can I lauch Safari silently using AppleScript and navigate to a url?</li>
  <li>How can I could programmatically register said AppleScript to
  launch on startup.</li>
  </ul>
  
  <p>I'm predominantly a c# windows developer so I'm a little out of my comfort zone here.</p>