Awesome tutorial for installing a Minecraft server on Mac.
I am reading a book to apply Python to Minecraft. The book is called “Learn to Program with Minecraft” by Craig Richardson.
This blog post was inspired by the procedure explained on the book.
Starting the server
Used for reference. Don’t start here:
- Right click > Open the file
- Open Minecraft
- Play > drop down > 1.11.2
pycraft-server. Join Server.
Setup a Mac environment
Start here. We need to install 5 components:
- Minecraft Python API
- Spigot Minecraft Server
You need to get an account and buy Minecraft. Installing is really easy.
Open the program and login. Click Play.
Go to Single Player > Create New World. I called it
There are a lot of tutorials about this.
I haven’t used the Mac for a long time so I had some issues. This is what I did:
$ sudo pip3 install --upgrade pip
I thought I previously had this installed. To check if you have it. Go to System Preferences and there should be an icon that says
But later in the process when I ran the Minecraft server it said:
No Java runtime present
Click the button:
Java Download. It’s just a square and it is easy to miss.
Scroll down and choose the radio button to accept the license.
Then download the
dmg for macOS.
Follow the GUI install process.
Install the API
Here is a summary of the process from the book:
- Download setup files for MAC:
- The file downloaded is:
- Extract the content:
Minecraft Tools Mac.
This folder has these:
Install the API by running this file:
Install_API.command. This opens the terminal and might ask for the admin password.
If this doesn’t work. Go to the terminal and locate the file:
$ sudo ./Install_API.command
The output was this:
The directory '/Users/tomordonez/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/Users/tomordonez/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Processing ./py3minepi-master Installing collected packages: py3minepi Running setup.py install for py3minepi ... done Successfully installed py3minepi-0.0.1
I tried this:
sudo chown -R $USER /Users/$USER/Library/Caches/pip
But it said the file didn’t exist. I checked this. Not sure how to solve this for now.
Run the server
Spigot is a single-player Minecraft server.
Minecraft Tools Mac directory. Right click > Open the file
Minecraft launch options
The book says to find the server version:
Starting minecraft server version 1.11.2
Go to Menu > Launch Options > Add New.
Enter a name. I entered:
Select the version:
Save and close the Launch Options. Click the logo to go to the main screen.
PLAY, drop down now has the option:
It will start downloading this version.
Add the server to Minecraft
When Minecraft opens. Go to Multiplayer.
For server name I put:
For server address:
The added server will show up. Click on it and
Minecraft will launch the world.
The server output shows:
[15:51:17 INFO]: UUID of player my-username is 3b1c5... [15:51:18 INFO]: my-username[/127.0.0.1:51952] logged in with entity id 1633 at ([world]-49.5, 61.0, -154.5)
Navigating the world
I am not an expert in Minecraft. I only played it a few times.
To leave the window. Click
It says that the world is set to
- Fly: Tap space twice
- Up: Press space
- Down: Shift
- Stop Flying: Tap space twice again.
Create a new world
The book has some tips about creating a new world.
- In Minecraft, leave the game to go back to the menu.
- Close the server shell.
- Create a copy of the folder
Minecraft Tools Mac.
- Go to the server folder
- Delete the folders: world, world_nether, world_the_end
- Start the server on the new copy.
Close the server by typing ‘stop’. Then close the shell.
Inside the server folder:
- Open the file
- Change this
- To this
Switch from Creative to Survival
The book says that it is a good idea to test Python programs in Survival mode. By default the config is in Creative mode.
gamemode=1is Creative mode.
gamemode=0is Survival mode.
Test your setup
- Start the server
- Start Minecraft in multiplayer mode and selecting the server.
- Open another shell
- Open the python shell:
- Import the module:
>>> from mcpi.minecraft import Minecraft.
- Create a Minecraft object:
>>> mc = Minecraft.create()
Minecraft class methods
The Minecraft class has these methods:
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'create', 'getBlock', 'getBlockWithData', 'getBlocks', 'getHeight', 'getPlayerEntityIds', 'postToChat', 'restoreCheckpoint', 'saveCheckpoint', 'setBlock', 'setBlocks', 'setting']
Minecraft object methods
The Minecraft object
mc has these methods:
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'camera', 'conn', 'create', 'entity', 'events', 'getBlock', 'getBlockWithData', 'getBlocks', 'getHeight', 'getPlayerEntityIds', 'player', 'postToChat', 'restoreCheckpoint', 'saveCheckpoint', 'setBlock', 'setBlocks', 'setting']