Install elastic search on macOS with Homebrew

To install with Homebrew, you first need to tap the Elastic Homebrew repository:

brew tap elastic/tap

Once you’ve tapped the Elastic Homebrew repo, you can use brew install to install the latest version of Elasticsearch:

brew install elastic/tap/elasticsearch-full

Then we start elastic search service

brew services start elastic/tap/elasticsearch-full

After that we make sure elastic search is running by execute this command

curl http://localhost:9200

The output should be like this:

{
  "name" : "Mohameds-MacBook-Pro.local",
  "cluster_name" : "elasticsearch_mohd",
  "cluster_uuid" : "KxxWtfPBS_WTJ43c8rql8Q",
  "version" : {
    "number" : "7.17.4",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "79878662c54c886ae89206c685d9f1051a9d6411",
    "build_date" : "2022-05-18T18:04:20.964345128Z",
    "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"

Hope this helps.


Comments

One response to “Install elastic search on macOS with Homebrew”

  1. Fix erros:

    Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/mohd/Library/LaunchAgents/homebrew.mxcl.elasticsearch-full.plist` exited with 5.

    tail -n20 /opt/homebrew/var/log/elasticsearch.log

    if you find this error:
    java.lang.RuntimeException: can not run elasticsearch as root

    use this command:

    rm -frv /opt/homebrew/var/log/elasticsearch.log