15

My sister got Minecraft yesterday and we're unable to join each others' LAN servers. We're on the same Wi-Fi router, neither of us have firewalls blocking Java and have updated to the most recent version, we're both on the same version of Minecraft, etc. The other troubleshooting articles/questions I've seen are aimed at Windows users-- both of us are on OS X El Capitan. Thank you in advance for your help!

  • Explain more on what won't work. I had this happen before to me, I took a computer to a friends house, and it wouldn't connect. I didn't look into fixing it though. Make sure it's the same version of Minecraft? – Akidus May 31 '16 at 21:43
14

Description

Assuming you've done the normal troubleshooting (such as disabling the Firewall), you're experiencing bug with the networking protocol being used on MacOS (IPv6 versus IPv4), documented in detail here:

The fix is to tell Java to prefer IPv4. This is not trivial as it requires forcing a _JAVA_OPTION override at launch (or system wide).

Diagnose

To diagnose this as the cause, first launch Minecraft from terminal with the _JAVA_OPTIONS overridden.

  1. Close Minecraft
  2. Open 🔎 Spotlight (🔎 in upper right of Desktop)
  3. Search for "Terminal", open the app
  4. Paste the following command in:

    _JAVA_OPTIONS=-Djava.net.preferIPv4Stack=true /Applications/Minecraft.app/Contents/MacOS/launcher
    
  5. Attempt to connect to LAN server and see if it fixes the problem

Permanently Fix

Using Minecraft Launch Options: @TheOnlyMrCat provides a method here that does not involve editing any files by hand. Please try that before making changes to the Minecraft launcher.

Patching the launcher manually:

Use this method only if you have problems using @TheOnlyMrCat's solution.

This _JAVA_OPTIONS override can be provided in many locations but since launching from Terminal is not ideal, we need to use a technique that fixes when clicking on the icon. At time of posting, the Apple recommended method for providing overrides is inside the App bundle itself using something called LSEnvironment

  1. Optionally install a Text Editor such as Atom to edit XML files.
  2. Using Finder, go to Applications
  3. Locate (don't open) the Minecraft App
  4. Right click Minecraft, Show Package Contents
  5. Go into the Contents folder and locate Info.plist
  6. Right click Info.plist, Open With, Atom (or TextEditor)
  7. Near the bottom of the file, add the following in between the <!-- ####

    </dict>
    </plist>
        <key>NSHighResolutionCapable</key>
        <string>YES</string>
    
        <!-- ######## ADD ONLY CONTENT BELOW THIS LINE ######## -->
    
        <key>LSEnvironment</key>
        <dict>
            <key>_JAVA_OPTIONS</key>
            <string>-Djava.net.preferIPv4Stack=true</string>
        </dict>
    
        <!-- ######## ADD ONLY CONTENT ABOVE THIS LINE ######## -->
    
    </dict>
    </plist>
    
  8. Unfortunately this does not take effect right away. This is due to the way Mac caches it's launch services. Force refresh of the launch services using the following command from Terminal:

    cd /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/
    ./lsregister -kill -r -domain local -domain system -domain user
    

    (Note, the path of lsregister may be different, you can find it using find /System -name lsregister)

  9. Launch Minecraft from the icon and search for LAN games to confirm that the fix was properly applied.

  • 1
    Thank you for this answer. Btw it looks like the path for lsregister may change slightly depending on OS X version. I ended up locating it with find /System -name lsregister – Frank Farmer Nov 19 '17 at 22:34
  • 1
    This is great, the 'lsregister` command should be called with: ./lsregister -kill -r -domain local -domain system -domain user (Note the ./ at the beginning of the command.) – disperse Dec 9 '17 at 23:35
  • 1
    @disperse, done because it's slightly better. Note, on dozens of Macs ranging from 10.7 - 10.13, lsregister wasn't on the $PATH, so the original version shouldn't cause problems. – tresf Dec 10 '17 at 15:55
11

In the launcher, go into launch options and create a new profile.

Call it whatever you want and enable JVM Arguments. In the text box that highlights type in the following text at the end:

-Djava.net.preferIPv4Stack=true

Mac is simply using iPv6 instead of iPv4 to try to connect to LAN worlds. The above text fixes that and forces it to use iPv4 when avaliable

example

  • Much nicer than hacking the Info.plist file. Thanks! I've added this as the recommended method to the troubleshooting steps. – tresf Jan 26 '18 at 16:44
  • Don't forget to scroll down and hit Save after typing it in. – gattsbr May 10 '18 at 22:33
  • Note that "Advanced settings" needs to be enabled for JVM arguments. – Quantum7 Apr 27 at 18:43
1

I've noticed that Mac OS doesn't properly detect LAN worlds. The solution is to find the IP Address of the host, and then use the use Direct Connect to connect to the server.

To find your IP address on Mac, go to the Apple Logo Thing > About, and in that window that pops up there will be a link at the bottom. Click on it and it will open the System Profiler, and then in the Network tab it will show you your IP address. Then type that address into Direct Connect on the other laptop, and you've got yourself a friend XD

Have fun!

EDIT:

Whups, forgot something. When you open the LAN world, it will say something in chat like "Hosted LAN world on port 12345"

You have to type this port number in Direct Connect for this to work. Example:

IP Address:12345

0

On the Mac you want to host the computer his Esc and then select Open to LAN

Open to LAN

Then on the Mac you will be joining the game select Multiplayer from the main menu and you will see the game which you can then join.

Game to Join

If you've done these steps and are getting an error when trying to join the game please edit that error into your question.

-3

You both may need to download a program called LogMeIn Hamachi which is free and will allow you to connect.

Since you guys are using the same IP address, it won't let you connect. Without Hamachi, you can't connect from long distances; LAN stands for local area network.

With both of you using Hamachi, you can play. Its what I use. Look up instructions on how to use Hamachi, if you get confused.

  • 2
    We tend to expect better quality than "use this, and look up for yourself how to use it". Could you provide more detail on how Hamachi actually fixes this problem? – user106385 Jul 13 '16 at 4:35
  • Hamachi is used to simulate a LAN network over the internet. While it's possible it would also work around the IP4 problems when Hamachi is used by two people on the same intranet, it is definitely overkill. – Quantum7 Sep 24 '18 at 14:28

protected by Community Jul 31 '17 at 2:54

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.