Running Elasticsearch on Apple Silicon M4: Solving the SIGILL Java Crash

Running Elasticsearch on Apple Silicon M4: Solving the SIGILL Java Crash
JK styled
By Jochen Kressin
CEO / Founder

Introduction

Imagine you've just upgraded to an Apple Silicon M4 processor and macOS 15.2, eager to continue your Elasticsearch development work. You fire up your Docker container as usual, but instead of Elasticsearch starting smoothly, you're greeted with a cryptic SIGILL fatal error that crashes the Java Virtual Machine before Elasticsearch can even initialize.
This isn't an Elasticsearch bug. It's an underlying issue with how Java interacts with the newest Apple M4 processors inside Docker's virtualized Linux environment. If you're running Elasticsearch in Docker on an M4 Mac, you've likely encountered this frustrating problem. The good news is that there are a few reliable ways to get back up and running.

Problem Description

When you attempt to start Elasticsearch using Docker on an Apple M4 processor with macOS 15.2, the container crashes immediately with a fatal Java error. The error log shows:
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x0000ffff77c680a8, pid=8, tid=17
#
# JRE version:  (23.0+37) (build )
# Java VM: OpenJDK 64-Bit Server VM (23+37-2369, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, serial gc, linux-aarch64)
# Problematic frame:
# j  java.lang.System.registerNatives()V+0 java.base@23
#
# The crash happened outside the Java Virtual Machine in native code.
The crash occurs during Java's initialization phase, specifically in the System.registerNatives() method. The container exits with code 134, and Elasticsearch never gets a chance to start.
One important detail: the crash often happens even before the Elasticsearch server process starts. The Docker entrypoint first runs small command line tools (for example elasticsearch-keystore create, and in 7.x a Java version check), and those crash first. This matters a lot for the fix, as we'll see.

Root Cause Analysis

This issue stems from how the Java Virtual Machine's AArch64 SVE detection path behaves on Apple's M4 when the prctl system call is blocked inside Docker's virtualized Linux environment. It's worth being precise about the hardware here, because it's easy to get wrong: the M4 does not implement ordinary (non-streaming) SVE at all. It is an ARMv9.2-A design that exposes SME, along with streaming SVE, which is only a subset of SVE usable in streaming mode, and running normal non-streaming SVE instructions on it produces an illegal instruction. So the crash is an artifact of how the JVM probes for SVE, not evidence that the chip provides it. The problem has so far been observed on M4 Macs running macOS 15.2 under Docker's virtualized Linux, and not on earlier Apple Silicon machines (M1, M2, M3), though the precise reason those chips avoid the detection path is not something we can state with certainty.
The more precise mechanism, based on the community investigations, is this: during startup the JVM tries to determine the SVE vector length using the prctl system call. Inside the Linux virtual machine that Docker runs on macOS 15.2, that syscall is blocked by the sandbox, so the JVM ends up with an invalid vector length and executes an illegal instruction, producing the SIGILL signal. In other words, this is not simply "the CPU lacks support." It is the virtualized environment blocking the detection path.
The relevant bug reports are tracked in the OpenJDK project (JDK-8345296) and in AWS Corretto's issue tracker. Elastic has characterized this as an Apple bug specific to M4 processors.
One more thing to know before the fix: you might reach for the JAVA_TOOL_OPTIONS environment variable to pass a JVM flag, and that works for many other Java containers. Elasticsearch, however, deliberately ignores it and logs:
warning: ignoring JAVA_TOOL_OPTIONS=-XX:UseSVE=0
So you need a mechanism that Elasticsearch actually honors, and that also reaches the command line tools that crash first.

Solution

First, try updating Docker Desktop and Elasticsearch

Before applying any JVM flag, check whether a simple update resolves the problem. A fix for this crash shipped in Docker Desktop 4.39, and users have confirmed that Elasticsearch starts cleanly on Docker Desktop 4.39 or later without any extra flags, including on 7.17.x, 8.16.x, and 8.17.x images. Note that this was fixed by the Docker Desktop update, not by a macOS point release, so don't count on a macOS update alone.
Separately, the underlying JVM bug (JDK-8345296) has been fixed in newer JDK builds, so a current Elasticsearch version that bundles a patched JDK may no longer need the workaround at all. Updating is the cleanest fix. If you can't update, use one of the workarounds below.

The JVM flag workaround

The flag itself is -XX:UseSVE=0, which disables SVE in the JVM and prevents the illegal instruction. The trick is passing it through a mechanism Elasticsearch honors, and one that also covers the command line tools that run before the server.
The universal option (works for 7.x and 8.x): _JAVA_OPTIONS
Unlike JAVA_TOOL_OPTIONS, Elasticsearch does not strip _JAVA_OPTIONS, and it applies to every JVM launch in the container, including the pre-flight tools:
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
    environment:
      - discovery.type=single-node
      - _JAVA_OPTIONS=-XX:UseSVE=0
    ports:
      - "9200:9200"
The explicit option for 8.x: set both ES_JAVA_OPTS and CLI_JAVA_OPTS
If you prefer the Elasticsearch-specific variables, be aware that ES_JAVA_OPTS only applies to the server process. The crash happens in the command line tools first, and those read CLI_JAVA_OPTS. So you need both:
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
    environment:
      - discovery.type=single-node
      - ES_JAVA_OPTS=-XX:UseSVE=0
      - CLI_JAVA_OPTS=-XX:UseSVE=0
    ports:
      - "9200:9200"
Setting only ES_JAVA_OPTS is a common mistake, because the keystore step still crashes before the server starts.
Elasticsearch 7.x
For 7.17.x the server specific variables don't reliably cover the Java version check that crashes first, and mounting a jvm.options.d file doesn't help either, because that file isn't read by those early tools. The reliable options for 7.x are:
    Use _JAVA_OPTIONS=-XX:UseSVE=0 as shown above. This is the simplest path and works for both 7.x and 8.x.
    Or build a custom image that uses a different JDK, for example installing openjdk-17 and pointing ES_JAVA_HOME at it:
FROM docker.elastic.co/elasticsearch/elasticsearch:7.17.26
RUN apt-get update -qq && \
    apt-get install --no-install-recommends -y openjdk-17-jdk && \
    rm -rf /var/lib/apt/lists /var/cache/apt/archives
ENV ES_JAVA_HOME="/usr"

Alternative: run the x86_64 image under emulation

If you'd rather not touch JVM flags at all, you can run the amd64 image through Rosetta emulation, which sidesteps the aarch64 SVE path entirely:
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
    platform: linux/amd64
    environment:
      - discovery.type=single-node
    ports:
      - "9200:9200"
Make sure "Use Rosetta for x86/amd64 emulation" is enabled in Docker Desktop. Emulated images run slower than native ARM64 images, so treat this as a convenience for development rather than a production setup.

Simplest for local development: start-local

If you're developing locally and want the least friction, use Elasticsearch's start-local feature, which detects your platform and applies the necessary workaround automatically:
curl -fsSL https://elastic.co/start-local | sh

Verification

After applying any of the above, start your container and check the logs. You should see Elasticsearch starting normally without the SIGILL error. Confirm it's running with:
curl http://localhost:9200
You should receive a JSON response with cluster information.

A caveat on the flag

-XX:UseSVE=0 only exists in JDK versions that added SVE support. On the affected images this is fine, since the JDKs that hit this crash are exactly the ones that understand the flag. But if you ever apply it to an older JDK that predates SVE support, the JVM rejects it with Unrecognized VM option 'UseSVE=0', so match the flag to the runtime you're actually using.

Takeaways

    This is a platform issue, not an Elasticsearch bug. It affects Apple M4 processors running Elasticsearch in Docker on macOS 15.2, and stems from the JVM's SVE detection path under a blocked syscall, not from the M4 actually providing SVE (it doesn't implement non-streaming SVE). It has not been observed on earlier Apple Silicon machines (M1, M2, M3).
    Try updating first. Docker Desktop 4.39 or later fixes the crash without any flag, and a current Elasticsearch that bundles a patched JDK may not need the workaround at all.
    Don't rely on JAVA_TOOL_OPTIONS. Elasticsearch ignores it. Use _JAVA_OPTIONS, or the Elasticsearch-specific variables.
    For 8.x, set both ES_JAVA_OPTS and CLI_JAVA_OPTS. The crash happens in command line tools that read CLI_JAVA_OPTS, so ES_JAVA_OPTS alone is not enough.
    For 7.x, prefer _JAVA_OPTIONS or a custom JDK image. A mounted jvm.options.d file doesn't cover the pre-flight tool that crashes first.
    Emulation is a fallback. Running the amd64 image via Rosetta avoids the issue at the cost of performance.
    Consider start-local for development. It applies the platform workaround for you.
    Document your setup. If your team has a mix of Mac models, note which workaround M4 users need so they can get running quickly.
Published: 2026-12-03
Questions? Drop us a line!
your message
newsletter
This form collects your name and email. Please take a look in our privacy policy for a better understanding on how we protect and manage your submitted data.
Processing

Other posts you may like

Sign up for Search Guard Newsletter