Tutorials/Create a Mac OS X startup daemon

= Introduction = Creating a proper and safe Mac OS X daemon a relatively hard task, and this document is a work in progress. It works for me, it might not for you. Please refrain from doing so unless you know your way around Terminal and Console, and you have a good analytical mind that will tell you whenever you are doing mistakes. Take this text as a helping hand, not as a full "run this package and it works" text. Evil lurks around and your computer might never look the same! Be warned!

This page will help you make your Minecraft server securely run without having to log in as a user.

Before even attempting this, you should run a server instance by hand, to make sure everything works. If you are able to run your server and actually connect to it from a remote computer, you can start thinking about creating a daemon.

= Creating a _minecraft daemon user and group = This section is technically optional, but for security considerations, you should do the hard way.

The easiest (and evil) way
And you are done! Congratulations! That will make your Minecraft application run as root, meaning if someone hacks your computer through Minecraft, it'll be able to do anything he wants, including viewing and modifying all your files, or simply deleting your computer into oblivion. Seriously, you do not want that! Please go to the Hard way and sweat your way. I'm a completionist, so I tell you the possibility to run it like that, but please don't ... please ...
 * 1) Don't do anything (Please make sure to modify the launchd plist file to remove the RunAsUser part)

The easy (and incorrect) way
And you are done! Congratulations! However, this creates a full fledged user, whilst Mac OS X expects a daemon user. As a side bonus, you can run this as your own personal user, or any other possibilities for users. But then, if your Minecraft user gets hacked, the hacker will have a full account to have fun, accessing all your software, and be able to modify everything that's public. It's not the best.
 * 1) Click on Apple menu item
 * 2) Open System Preferences
 * 3) Click on System: Accounts
 * 4) Click on the lock in order to unlock the page
 * 5) Enter your administrator password
 * 6) Click on the Plus button
 * 7) Create a new Standard user, named Minecraft (Please make sure to modify the launchd plist file saying you are using a different user) with a password
 * 8) Click Ok

Moving the server files
= Support files = You need a few files in order to make this work adequately. It could be done with less files, but it's more readable that way. Please copy them carefully.

Launchd plist
= Tying it up =