How to setup minecraft server on a mac – Part 2: Setup Local Client


This is the second part of a three part series on how to setup a multiplayer server on a Mac.

Part 1: Setup Server
Part 2: Setup Local Client
Part 3: Setup Internet Client

Part 2: Setup Local Client

With our server setup from Part 1 we are now ready to try connecting to it with a local client.

Download the Minecraft client for Mac if you haven’t already.


Fire it up, hit the ‘Play’ button, select ‘Multiplayer’ or ‘Play with my crew’


Now to play locally we need your local IP address. To get this go (System Preferences > Network)


And then note the 10.0.1.x address. That’s your local IP address and the address that your server is running on locally. We are going to connect to that from this computer (kind of like connecting to ourselves).


Anyone else wishing to connect to use could use this information also if they are on our wi-fi.

So let’s connect to ourselves. Go back to Minecraft, click ‘Add Server’ and enter the following:


The 10.0.1.x is the local IP address of your machine.
25565 is the port number Minecraft listens on for incoming connections.

If that works, you should see something like this with green bars.


If it doesn’t work you will see something like this with a red x.


To connect to your new local server, simply highlight and click ‘Join Server’.

And if everything works, you should now be connected to your very own Minecraft server!


Coming soon. Part 3 – How to let others on the internet connect to your server.

How to setup minecraft server on a mac – Part 1: Setup Server


These instructions are based on the official mac instructions at minecraft site.

If you don’t need much help, go there. But if you like pictures, start here.

This is the first part of a three part tutorial:

  • Part 1: Setup Server
  • Part 2: Setup Local Client
  • Part 3: Setup Internet Client

Part 1: Setup Server

Download the minecraft server jar file.

Create a directory called ‘server’ and drag the jar file in there.


Make a command file

To make it easy to start your server, we are going to create a ‘start.command’ file. Double clicking this file will launch your server.

Open TextEdit (/Applications/TextEdit).

Set the format to plain text.


Copy in the following text.

cd "$(dirname "$0")"
exec java -Xmx1G -Xms1G -jar minecraft_server.jar

Be sure to change the minecraft_server.jar to match the name of the jar in the directory (in my case minecraft_server.1.7.4.jar).

Save it in the same directory as your jar file.


Make this command executable by opening a terminal (/Applications/Terminal) and typing

chmod a+x

with a space after it. Drag and drop the start.command file into the terminal window and then press enter.


Double click the start server to start the server.

If all works a new server window will open and you will see several errors about missing files and directories – don’t worry this is fine.


Congrats! You’ve setup the server. Next we are going to configure Time Capsule so your server runs for everyone on your network.

If you ran into problems, check this troubleshooting section for fixes.

Troubleshooting server setup

Unable to access jarfile error

If you got ‘Unable to access jarfile’ when double clicking the start.command file,


the filename in your start.command file doesn’t match the jar file name on disk.

Fix this by opening the start.command file


and changing the filename to be correct (make sure you get the numbers, in my case, 1.7.4 included in the file name).


Rich-text-format error

If your text file keeps wanting to rename itself start.rtf, it’s because you haven’t made the text file ‘plain text format’. Go over the instructions again above, and make this file plain text format.

Configure Time Capsule

Before any clients can connect to our server, we need to configure Time Capsule to keep a static local IP address, and tell it what port number our server is going to be running on.

You may need your mom or dad for this step (because it will require Time Capsule password).

Open System Preferences > Network


Click the advanced button in the lower right hand corner. And then the ‘TCP/IP’ tab.


Where it says Configure IPv4, change that option to ‘Using DHCP with manual address’.

Change the IP address to 10.0.1.x, where x can be any number from 1 to 100.

Note the address you type here: 10.0.1.x. You are going to need it later when we setup the Airport Utility

Hit OK and go back to ‘System Preferences.

You may need to save your changes before leaving the ‘Network’ preferences first. That’s OK.


Now go to the ‘Sharing’ section of System Preferences and make sure that Internet Sharing is on.


Do this by first clicking on ‘USB Ethernet’


And then double clicking ‘Internet Sharing’ on the left hand side. When it asks you if you really want to enable Internet Sharing say ‘OK’.


Now, open up AirPort Utility and edit your Time Capsule settings.



Click the Time Capsule image and then the ‘Edit’ button in the lower right.

Go under Network and make sure the option Router Mode is set to DHCP and NAT. Now, click the + button under the Port Settings.

Type in the following:

  • Description: Minecraft Server (or whatever you want to call it)
  • Private IP Address: The address you chose for the 4th step.

Change everything with the word port in it to 25565.


It should look something like this now.


Now hit ‘Update’ and update the Time Capsule.

OK. At this point you should be good.
You have a server.
You have a router that knows about your server and won’t try to change your IP address.
Next we are going to setup the local client.
And then after that the internet client.

Coming soon.

Part 2: Setup Local Client
Part 3: Setup Internal Client

How to setup OCMock XCode 4 iOS 5


This was harder than I would have liked. Here’s some notes on how to set it up.

Setup OCUnit on your existing project

These notes from Apple are pretty good about how to setup OCUnit on your XCode project.

The only difference was when I ran my unit tests (Product -> Test) I had to manually add my own unit test scheme.

Just hit the ‘Edit Scheme’ button, then hit the ‘+’ sign and click on your target unit tests and click the ‘Add button’.

You should now be able to run your tests against the simulator (not real phone) and see the failure.

Setup OCMock

Create a Libraries directory

Create a ‘Libraries’ directory in your project by right clicking on your project icon and selecting ‘Add Files to …’.

Click the ‘New folder’ button, type the name ‘Libraries’, and click ‘Add’ so your libraries directory is at the same level as your project and unit test target. When your done it should look something like this:

Note: Make sure you select your ‘Test’ target (grey) not the main ‘Project’ target blue. Else you will make all these lovely changes to the wrong config and nothing will work.

Copy in libOCMock.a

Download the libOCMock.a and stick it in the Libraries directory we just created.

Then add it to your project by dragging it into the Libraries directory we just added to your project.

When you do a window will pop up, make sure you select the ‘Copy items’ box at the top and click on your unit test target so it will be linked to OCMock.

Copy OCMock header files

Download the latest OCMock dmg file, located the OCMock directory inside containing the header files, and just like we did before, drag it into the Libraries directory.

Again select ‘Copy’ and click your unit test target and now your directory structure should look like this:

Configure Build Settings

We now need to tell our project how to find these header files we just added.

Click your blue project icon (click somewhere else and then click it again if it doesn’t immediately change) and click the ‘Build Settings’ tab for your project.

In the ‘Search Paths -> Library Search Paths’ section add $(SRCROOT)/Libraries in double quotes to Debug and Release sections. Once you do they will automatically convert to your local machine paths as shown below.

Note: As of XCode 4.3 the Library Search Paths may already be configured for you. The headers ones through aren’t.

And then do the exact same thing for the ‘Search Paths ->Header Search Path’ section (be sure to double click on it after and make sure both are set to ‘recursive’).

Note: As of XCode 4.3 you won’t see the word recursive here – just the box. Click it for both. If you don’t when you run your test you won’t be able to find the OCMock header files.

Next head down to the ‘Linking -> Other Link Flags’ section and add the ‘-all_load’ option.

If you don’t do this you’ll get a “Did you forget to add the -force_load linker flag?” error when you run your tests and you can read about why here.

Add a mock test case

We should now be good to go. Open you the default test case OCUnit created for you and add the following:

#import "UnitTests.h"
#import <OCMock/OCMock.h>

@implementation UnitTests

- (void)setUp
    [super setUp];
    // Set-up code here.

- (void)tearDown
    // Tear-down code here.
    [super tearDown];

- (void)testExample
    //STFail(@"Unit tests are not implemented yet in UnitTests");

- (void)testOCMockPass {
    id mock = [OCMockObject mockForClass:NSString.class];
    [[[mock stub] andReturn:@"mocktest"] lowercaseString];
    NSString *returnValue = [mock lowercaseString];
    STAssertEqualObjects(@"mocktest", returnValue, @"Should have returned the expected string.");


If everything worked, you should be able to run your test now and see a nice failure in your log output window:

Links that help:

%d bloggers like this: