5 thoughts on “How to launch at login your Xamarin.Mac sandboxed application

  1. Chris Hamons

    “For some reason, Xamarin decided not to add SMLoginItemSetEnabled function to the framework but we can easily do that!”

    The short answer is that we know we don’t have bindings for everything yet on XM. 🙂

    The entirety of the Cocoa (and related) API is huge.

    I’ve filed a bug for the specific API here:


    I’ve never come across Cake before either, pretty cool.

    Liked by 1 person

  2. jonc

    Thanks for your post. This was helpful. By the way, have you solved how to check if SMLoginItemSetEnabled is set for the app? SMJobCopyDictionary does not work in a Sandboxed app also marked as deprecated by Apple. My solution was to save a bool LaunchAtLogin with NSUserDefaults. On subsequent launch if LaunchAtLogin is true, I reset SMLoginItemSetEnabled just to confirm that its still true.

    Cake seems helpful. How are you creating your installer package, can you add that to the cake build script? I had some trouble with getting cake to take the configuration, I entered Debug and I continued to build Release. For the moment I wrote a shell script to cp the helper app into the main app and added it to Xamarin as a Before Build command.


    1. Artur Shamsutdinov Post author

      Your way of detecting if the app starts at login seems to be the best one. I use the same approach.
      The only other way I know is quite complicated:
      1. do not terminate helper app in DidFinishLaunching
      2. wait till the main app is launched
      3. check if helper app is running in the main app
      4. send a notification from the main app
      5. handle notification in the helper app and then terminate it.

      No, I use this app http://s.sudre.free.fr/Software/Packages/about.html to create a package project. Then build a package with a bash script and console utility from the app.

      This line of code should change building configuration: DotNetBuild(“./LoginItemTest.sln”, c => c.Configuration = configuration); and you can pass configuration to the build script but executing this command “./build.sd –configuration=Release”


  3. Pingback: Auto launching Xamarin Mac apps at login | Damian Mehers' Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s