Fix elastic search not working in macOS 13 Ventura

Hello,
any one got this error after upgrade to macOS Ventura.
“jdk is damaged and can’t be opened. You should move it to the Trash.”here is a quick fix. Until Elastic search company makes an updatein terminal install the latest version of openjdk with Homebrew

brew install openjdk 
echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

if you still using old bash terminal change this to

echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

in terminal

nano /opt/homebrew/Cellar/elasticsearch-full/7.17.4/homebrew.mxcl.elasticsearch-full.plist

add the following lines:

<key>EnvironmentVariables</key>
<dict>
  <key>ES_JAVA_HOME</key>
  <string>/Library/Java/JavaVirtualMachines/jdk-19.0.1.jdk</string>
</dict>

Right after this line:

<string>/opt/homebrew/var</string>

If you got permission error like this

MacBook-Pro ~ % brew services start elastic/tap/elasticsearch-full
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/mohd/Library/LaunchAgents/homebrew.mxcl.elasticsearch-full.plist` exited with 5.

Fix permission of the folder by doing these commands

sudo chown -R $(whoami) /Library/Java/JavaVirtualMachines/jdk-19.0.1.jdk
sudo chmod -R 755 /Library/Java/JavaVirtualMachines/jdk-19.0.1.jdk

Then restart elastic search or start it right away.

brew services start elastic/tap/elasticsearch-full

or

brew services restart elastic/tap/elasticsearch-full

Test if elastic search is working.

curl http://localhost:9200

You should get something like this

{
  "name" : "Mohameds-MacBook-Pro",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "",
  "version" : {
    "number" : "7.17.4",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "",
    "build_date" : "",
    "build_snapshot" : false,
    "lucene_version" : "8.11.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Add a comment if you need any help!

Have a great day!


Comments

2 responses to “Fix elastic search not working in macOS 13 Ventura”

  1. zekeriya hacimuhammed Avatar
    zekeriya hacimuhammed

    I have added these configs but didnt work
    yes this alet message to delete apk file gone but but still showing another notification something is wronge

    1. What version of OS you are wokring at?

      Did you install openjdk

      also what version of Elastic search you use?

      you need to install the latest version of elastic search

      I have uploaded my configuration file i use for you

      You can download it from here: https://bit.ly/3vjI1tl