Skip to content

Instantly share code, notes, and snippets.

@tanmayb123
Created November 3, 2021 17:07
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanmayb123/80c83c8c5d5fd370cb70a88ca711d848 to your computer and use it in GitHub Desktop.
Save tanmayb123/80c83c8c5d5fd370cb70a88ca711d848 to your computer and use it in GitHub Desktop.

Minecraft on Apple Silicon (v2 - 1.17 & Microsoft authentication)

In this gist, you can find the steps to run Minecraft 1.17 natively on Apple Silicon (AS), without needing Rosetta 2 translation of the dependencies (mainly LWJGL and related libraries).

While it's possible to use a launcher like MultiMC to have a prettier way to run the game on AS, it requires installing even more dependencies (like QT) which take time and are difficult to distribute. Therefore, I've put together a command line-based launcher tool using a couple shell & Python scripts.

To get up and running quickly, follow the steps below. Otherwise, for more detail, watch my YouTube videos: old, new.

Download my package

To begin, download the Minecraft on Apple Silicon package I've already put together, containing some pre-compiled core dependencies like LWJGL and a convenient set of setup & launcher scripts. Unzip the file, and navigate to it in your terminal. Then follow the next steps.

Download NPM modules required for Microsoft authentication

You only need to run this if you plan on using a Microsoft account for authentication

npm install --global @xboxreplay/xboxlive-auth request

Download Minecraft client & client libraries

cd libraries
sh download.sh
cd ..

Download Minecraft assets

python3 downloadassets.py

Run Minecraft! (Microsoft account)

Note: Replace email@address.com and password with your actual username & password for Minecraft, but keep them enclosed in single quotes. This data is only used to communicate with Mojang's authentication servers and is never stored. The file containing your authtoken is deleted after the game launches.

export MCEMAIL='email@address.com'
export MCPASSWORD='password'

sh launch.sh

Run Minecraft! (Mojang account)

Note: Replace email@address.com and password with your actual username & password for Minecraft, but keep them enclosed in single quotes. This data is only used to communicate with Mojang's authentication servers and is never stored. The file containing your authtoken is deleted after the game launches.

sh mojang_launch.sh 'email@address.com' 'password'

@rock-skinned-bird
Copy link

I got "zsh: command not found: npm" when I was trying to run "npm install --global @xboxreplay/xboxlive-auth request". why is that?

@mmshivesh
Copy link

@rock-skinned-bird You need to have npm installed in your computer to start. If you have brew, try running brew install node which should also give you npm.

@rock-skinned-bird
Copy link

@mmshivesh thank you! I downloaded npm and was able to download Minecraft assets. but when I do `export MCEMAIL='email@address.com'
export MCPASSWORD='password'

sh launch.sh`

I get `
sh launch.sh
node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module '@xboxreplay/xboxlive-auth'
Require stack:

  • /Users/parker/Desktop/MCAppleSilicon 2 copy/auth.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object. (/Users/parker/Desktop/MCAppleSilicon 2 copy/auth.js:1:22)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [ '/Users/parker/Desktop/MCAppleSilicon 2 copy/auth.js' ]
    }

Node.js v17.0.1
cat: mcuuid: No such file or directory
cat: mcusername: No such file or directory
cat: mcauthtoken: No such file or directory
rm: mcuuid: No such file or directory
rm: mcusername: No such file or directory
rm: mcauthtoken: No such file or directory
cp /Users/parker/Desktop/MCAppleSilicon 2 copy/libraries/minecraft-1.17-client.jar
`
what's wrong?

@mmshivesh
Copy link

Did you run the npm install step?

@wilsybubs
Copy link

It doesn't let me open it because it says it cannot be verified. But when try to allow it or open it in finder it opens another terminal tab, but nothing ever opens

@n3tw0rk3rhh
Copy link

Minecraft won't start with errors in log. I reproduced this on a M1 Air and an M1 Pro 14. mojang_launch.sh exits with:
cp /Users/claus/Documents/Minecraft/MCAppleSilicon/libraries/minecraft-1.17-client.jar

latest.log

[09:32:52] [main/WARN]: Failed retrieving info for group hardware
java.lang.NoClassDefFoundError: oshi/SystemInfo
at ac.c(SourceFile:51) ~[minecraft-1.17-client.jar:?]
at ac.a(SourceFile:81) [minecraft-1.17-client.jar:?]
at ac.(SourceFile:51) [minecraft-1.17-client.jar:?]
at q.(SourceFile:32) [minecraft-1.17-client.jar:?]
at q.h(SourceFile:275) [minecraft-1.17-client.jar:?]
at net.minecraft.client.main.Main.main(SourceFile:137) [minecraft-1.17-client.jar:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?]
at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:196) [NewLaunch.jar:?]
at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:231) [NewLaunch.jar:?]
at org.multimc.EntryPoint.listen(EntryPoint.java:143) [NewLaunch.jar:?]
at org.multimc.EntryPoint.main(EntryPoint.java:34) [NewLaunch.jar:?]
Caused by: java.lang.ClassNotFoundException: oshi.SystemInfo
at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636) ~[?:?]
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
... 14 more
[09:32:54] [Render thread/INFO]: [STDERR]: [LWJGL] Failed to load a library. Possible solutions:
a) Add the directory that contains the shared library to -Djava.library.path or -Dorg.lwjgl.librarypath.
b) Add the JAR that contains the shared library to the classpath.
[09:32:54] [Render thread/INFO]: [STDERR]: [LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[09:32:54] [Render thread/INFO]: [STDERR]: [LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
[09:32:54] [Render thread/WARN]: Failed retrieving info for group hardware
java.lang.NoClassDefFoundError: oshi/SystemInfo
at ac.c(SourceFile:51) ~[minecraft-1.17-client.jar:?]
at ac.a(SourceFile:81) [minecraft-1.17-client.jar:?]
at ac.(SourceFile:51) [minecraft-1.17-client.jar:?]
at q.(SourceFile:32) [minecraft-1.17-client.jar:?]
at q.a(SourceFile:267) [minecraft-1.17-client.jar:?]
at net.minecraft.client.main.Main.main(SourceFile:185) [minecraft-1.17-client.jar:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?]
at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:196) [NewLaunch.jar:?]
at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:231) [NewLaunch.jar:?]
at org.multimc.EntryPoint.listen(EntryPoint.java:143) [NewLaunch.jar:?]
at org.multimc.EntryPoint.main(EntryPoint.java:34) [NewLaunch.jar:?]
[09:32:54] [Render thread/INFO]: [STDERR]: Failed to start Minecraft:
[09:32:54] [Render thread/INFO]: [STDERR]: java.lang.reflect.InvocationTargetException
[09:32:54] [Render thread/INFO]: [STDERR]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[09:32:54] [Render thread/INFO]: [STDERR]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[09:32:54] [Render thread/INFO]: [STDERR]: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[09:32:54] [Render thread/INFO]: [STDERR]: at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[09:32:54] [Render thread/INFO]: [STDERR]: at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:196)
[09:32:54] [Render thread/INFO]: [STDERR]: at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:231)
[09:32:54] [Render thread/INFO]: [STDERR]: at org.multimc.EntryPoint.listen(EntryPoint.java:143)
[09:32:54] [Render thread/INFO]: [STDERR]: at org.multimc.EntryPoint.main(EntryPoint.java:34)
[09:32:54] [Render thread/INFO]: [STDERR]: Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.mojang.blaze3d.systems.RenderSystem
[09:32:54] [Render thread/INFO]: [STDERR]: at ac.a(SourceFile:65)
[09:32:54] [Render thread/INFO]: [STDERR]: at dvp.a(SourceFile:2417)
[09:32:54] [Render thread/INFO]: [STDERR]: at dvp.a(SourceFile:2412)
[09:32:54] [Render thread/INFO]: [STDERR]: at net.minecraft.client.main.Main.main(SourceFile:187)
[09:32:54] [Render thread/INFO]: [STDERR]: ... 8 more
[09:32:54] [Render thread/INFO]: [STDOUT]: Exiting with -1

@cmot17
Copy link

cmot17 commented Nov 11, 2021

Can you share how you were able to compile the dylibs for LWJGL? I've spent a while trying to figure it out and haven't managed it.

Edit: Also "lwjglfat.jar" - I haven't been able to find any info on what it is or how to compile it online.

@bkkkk
Copy link

bkkkk commented Nov 14, 2021

Thanks for this! Just FYI the internal .git directory is included in the archive making it larger than necessary.

@adamplayer
Copy link

@mmshivesh thank you! I downloaded npm and was able to download Minecraft assets. but when I do `export MCEMAIL='email@address.com' export MCPASSWORD='password'

sh launch.sh`

I get ` sh launch.sh node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module '@xboxreplay/xboxlive-auth' Require stack:

I got the same error as @mmshivesh. I found that taking off the --global flag, which is what the GitHub page for it does, allowed everything to work fine.

So my npm install became:
npm install @xboxreplay/xboxlive-auth request

@samholstein
Copy link

samholstein commented Nov 17, 2021

It took me some extra steps to get it to work. I had to select "Allow macOS to run 'lwgjl-......dylib' ten zillion times in Security settings in System Preferences) while I attempted to launch it over and over until it granted permission to everything in 'lwjglnatives'.

But when I launch it... the best way to describe it is that it's really slow. It takes several seconds to detect mouseovers or UI button clicks. It would not accept keyboard input in the Multiplayer Servers menu. I did not even try actually starting a game because it was clear from the tremendously slow performance in the menu UI that it would not work out well for me.

How can I fix this?

I tried restarting my computer and reinstalling the npm modules and Minecraft assets, but this did not fix it.

@carlossaeh
Copy link

After completing all the steps i ran the sh launch.sh line and was given this

Traceback (most recent call last):
File "getuuid.py", line 15, in
username = sys.argv[1]
IndexError: list index out of range
Traceback (most recent call last):
File "getusername.py", line 15, in
username = sys.argv[1]
IndexError: list index out of range
Traceback (most recent call last):
File "getauthtoken.py", line 15, in
username = sys.argv[1]
IndexError: list index out of range

Does anyone have a solution. I have verified that my email and password are the correct ones i use for the microsoft login.

@WGINC
Copy link

WGINC commented Dec 9, 2021

when running the download assets I get this

/Users/wadeglover/Downloads/MCAppleSilicon 2 copy/downloadassets.py: line 1: import: command not found
/Users/wadeglover/Downloads/MCAppleSilicon 2 copy/downloadassets.py: line 2: import: command not found
/Users/wadeglover/Downloads/MCAppleSilicon 2 copy/downloadassets.py: line 3: import: command not found
/Users/wadeglover/Downloads/MCAppleSilicon 2 copy/downloadassets.py: line 4: import: command not found
/Users/wadeglover/Downloads/MCAppleSilicon 2 copy/downloadassets.py: line 6: syntax error near unexpected token (' /Users/wadeglover/Downloads/MCAppleSilicon 2 copy/downloadassets.py: line 6: def download(o):'

@mxbi
Copy link

mxbi commented Dec 15, 2021

BTW, this package uses Log4j 2.14.1, so it's susceptible to the remote code execution exploit - any chance of a notice or update? @tanmayb123

@Pyrotex7
Copy link

Pyrotex7 commented Jan 3, 2022

You could technically just download the newer 2.16.0 jar files, and replace the 2.14.1 jar files with the new ones in the folders and the launch arguments.

@raphtlw
Copy link

raphtlw commented May 21, 2022

There is a new Application for macOS which does all the hard work for you, and all you need to do is click play. You can find the repository here and the installation steps here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment