0

I have spent more time on this task than I did actually creating the application.

I want to create an installer for my app that will:

  1. Install the app into /Applications
  2. Make the application launch on boot (it's just a menu bar status based app)

Number 1 is easy but I can get absolutely nowhere with getting #2 to work. I know I need to setup a postscript install somewhere I don't know how to make the script (I believe I need to put it in loginitems) and how to make it initialize as part of the package. My understandign from research is I need to look into making a postflight script but there is nothing at all in Package Manager for that.

Can someone please point me to something that works in 10.6+?

I've tried the script here in Add app to OSX "Login Items" during a Package Maker installer postflight script but it doesn't really explain where/how to actually add the script.

Community
  • 1
  • 1
john cs
  • 2,220
  • 5
  • 32
  • 50

1 Answers1

0

Launch at login can be a piece of cake or an absolute nightmare depending on wether or not your app is sandboxed. If it isn't sandboxed, then you can use LSSharedFileList to modify the login items preference pane: https://github.com/Mozketo/LaunchAtLoginController

If it is sandboxed then you're going to need to create a helper app: http://blog.timschroeder.net/2012/07/03/the-launch-at-login-sandbox-project/

The above tutorial didn't work for me on yosemite, I had to follow apple's sample code: https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLoginItems.html#//apple_ref/doc/uid/10000172i-SW5-SW1

As for the installer, check this answer here: https://stackoverflow.com/a/11487658/1320911

Community
  • 1
  • 1
Luke
  • 4,908
  • 1
  • 37
  • 59