Setting up a Minecraft Server on MacOS

Virgil
2 min readJan 25, 2021

Well, Minecraft is a gigantic mess. Horibble piece of software. But kids love it, so I had to set up a server for them. Setting up the server is really easy, but there are no good instructions on how to set it up as a daemon on MacOS. The “official” page is really an absolute joke.

So, let’s get started. Execute the following as root.

Step 1. Create a folder to host your Minecraft server, say /opt/minecraft

mkdir /opt/minecraft

Step 2. Put your Minecraft server, world, settings … over there.

Step 3. Make nobody the owner for this directory and set the right permissions.

chown -R nobody /opt/minecraft
chmod -R 755 /opt/minecraft

Step 4. Create a Launch Daemon (this will allow your Minecraft server to start when your Mac starts).

vi /Library/LaunchDaemons/net.minecraft.plist

Paste the content below (adjust for your needs if required):

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.minecraft</string>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/opt/minecraft</string>

<key>UserName</key>
<string>nobody</string>

<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
<string>-Xmx4096M</string>
<string>-Xms4096M</string>
<string>-jar</string>
<string>/opt/minecraft_server.jar</string>
<string>nogui</string>
</array>

</dict>
</plist>

Step 5. Load the Launch Daemon and test it out:

sudo launchctl load /Library/LaunchDaemons/net.minecraft.plist
#
# test that the server is running
#
ps auxww | grep java | grep minecraft | grep nobody
nobody 82405 35.4 6.4 13275488 4310236 ?? Ss 5:53PM 16:59.56 /usr/bin/java -Xmx4096M -Xms4096M -jar /opt/minecraft/minecraft.jar nogui

Step 6. Done! Your server is now running and it will restart the next time you reboot your machine.

You can manually stop your server with:

sudo launchctl stop net.minecraft

Re-start it:

sudo launchctl start net.minecraft

And unload it (won’t start at the next boot anymore):

sudo launchctl unload  /Library/LaunchDaemons/net.minecraft.plist

Not sure why it has to be so complicated…

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Responses (1)

Write a response

Hi Virgil, great post, I was looking for something like this for a long time, thank you. I have a question: how would you modify this daemon to send the command /stop to the minecraft server when the server shutdown or restarts? This would allow an organized shutdown saving the changes in the world and the players.