I have a fresh Macbook Air with M1 processor
Following official guide https://www.elastic.co/guide/en/elasticsearch/reference/current/brew.html I've tried to install elasticsearch 7 with:
brew tap elastic/tap
brew install elastic/tap/elasticsearch-full
once I try to start it with $ elasticsearch
I get this error:
/opt/homebrew/Cellar/elasticsearch-full/7.16.2/libexec/bin/elasticsearch-env: line 83: /opt/homebrew/Cellar/elasticsearch-full/7.16.2/libexec/jdk.app/Contents/Home/bin/java: Bad CPU type in executable
If I try to start the service with brew services start elastic/tap/elasticsearch-full
It will fails and I'll get same error in log file /opt/homebrew/var/log/elasticsearch.log
/opt/homebrew/Cellar/elasticsearch-full/7.16.2/libexec/bin/elasticsearch-env: line 83: /opt/homebrew/Cellar/elasticsearch-full/7.16.2/libexec/jdk.app/Contents/Home/bin/java: Bad CPU type in executable
Once I open the file (elasticsearch-env
) that causes the issue line 83 reads:
# check the Java version
"$JAVA" "$XSHARE" -cp "$ES_CLASSPATH" org.elasticsearch.tools.java_version_checker.JavaVersionChecker
If I try to execute
/opt/homebrew/Cellar/elasticsearch-full/7.16.2/libexec/jdk.app/Contents/Home/bin/java
I get the error
Bad CPU type in executable
So it seems a bad Java architecture was installed during the elasticsearch-full brew instalation (maybe instead of M1 it's x84 or something ?). This is fresh new Macbook bought couple of hours ago. Elasticsearch was first thing I've tried to brew install on it (so no prior Java application installed)
Anyone knows how to solve this pretty please ?