title: How distribute OSX cli / server app
body: <p>Im building a cli app that can run in server mode for osx in golang. I come from the server world and have no idea how properly distribute a consumer cli tool for osx. The cli can run as a service which can be easily achieved with launchd. </p>
  
  <p>Launchd config:</p>
  
  <pre><code>&lt;plist version="1.0"&gt;
      &lt;dict&gt;
          &lt;key&gt;KeepAlive&lt;/key&gt;
          &lt;true/&gt;
          &lt;key&gt;Label&lt;/key&gt;
          &lt;string&gt;focus-daemon&lt;/string&gt;
          &lt;key&gt;RunAtLoad&lt;/key&gt;
          &lt;true /&gt;
          &lt;key&gt;Program&lt;/key&gt;
          &lt;string&gt;/usr/local/bin/focus&lt;/string&gt;
    &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>Building and running is also quite simple:</p>
  
  <pre><code>go build main.go
  sudo cp main /usr/local/bin/focus
  rm main
  sudo chown root /usr/local/bin/focus
  sudo chmod 4555 /usr/local/bin/focus
  cp focus.plist ~/Library/LaunchAgents/com.21stio.focus.plist
  launchctl load ~/Library/LaunchAgents/com.21stio.focus.plist
  </code></pre>
  
  <p>When being build the process requires sudo to set a sbit on the binary.</p>
  
  <p>I don't want the user having to run a .sh script. Maybe I could use brew and/or a DMG for that. But I have no idea how I can put the <code>Launchd config</code> at the right spot then.</p>