/go-lunch

🥪 macOS launch agent creator for golang

Primary LanguageGoMIT LicenseMIT

Go Lunch Quality assurance GitHub release

A library for easily creating launch agent files to autorun your applications in macOS.

  • Easy interface
  • Pure Golang
  • Safe

Installation

Run command at your project directory.

go get -u github.com/mishamyrt/go-lunch

Usage

Create Agent instance with required fields: PackageName, Command, Path. For path you can use UserPath and SharedPath helpers. It returns launch agent path.

package main

import "github.com/mishamyrt/go-lunch"

const packageName = "com.domain.my-app"

func main() {
	path, _ := lunch.UserPath(packageName)
	agent := lunch.Agent{
		PackageName: packageName,
		Command:     "/usr/local/bin/my-app run -d",
		Path:        path,
	}
	agent.Write()
}

Parameters

  • PackageName - App package name
  • KeepAlive - Restart app on exit
  • Command - App start command
  • StandardOutPath - App stdout. Defaults to /dev/null
  • StandardErrorPath- App stderr. Defaults to /dev/null
  • Path - Launch Agent path