Installing Elasticsearch 5.4 on Mac OS 10

The easiest way to install Elasticsearch is using brew. However it failed to install on my Mac OS 10.9.5

Failed Installation using Brew

You can use Brew:

brew update
brew install elasticsearch

This failed with:

elasticsearch: Java 1.8+ is required to install this formula.
JavaRequirement unsatisfied!

You can install with Homebrew-Cask:
  brew cask install java

You can download from:
Error: An unsatisfied requirement failed this build.

Install Java:

brew cask install java

Install elasticsearch:

brew install elasticsearch
Error: elasticsearch 1.7.1 is already installed
To upgrade to 5.4.0, run `brew upgrade elasticsearch`

I had older version installed, to update:

brew upgrade elasticsearch

This installed elasticsearch 5.4.0 on my Mac. To start the ElasticSearch server:

-bash: /bin/elasticsearch: No such file or directory
~/projects/lafon $which elasticsearch



This gave 'Permission denied' error. If you run it as sudo:

sudo /usr/local/bin/elasticsearch

 can not run elasticsearch as root

Running chmod or chown:

$chmod 777 /usr/local/var/log/elasticsearch
$chown bparanj /usr/local/var/log/elasticsearch

did not help.

Installing from Source

Installing from source is another option. Java 8 (only Oracle’s Java) is the prerequisite. Check if Java is installed on your machine.

java -v
No Java runtime present, requesting install.

Let's install Java version 1.8.0_73 or later. Download Java and run the installer to install Java. Go to control panel and click on Java to check the installed version. Install wget:

$ brew install wget

Download Elasticsearch:


You can also use Curl:

curl -L -O

and extract it using tar:

tar -xvf elasticsearch-5.4.0.tar.gz

Check sha1sum:

$ brew install md5sha1sum


Go to The downloaded file will contain the sha. Compare the sha output from the terminal to the sha in the downloaded file. They should match.

$ ./bin/elasticsearch

No Java runtime present, requesting install.
Elasticsearch requires at least Java 8 but your Java version from /usr/bin/java does not meet this requirement

You need JDK not JRE, download Java SE Development Kit and install it. Check the version in the terminal:

$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Go to the directory where you unzipped the elasticsearch zip file, elasticsearch-5.4.0 directory and run:

$ ./bin/elasticsearch

Check Elastisearch installation:

$ curl -XGET 'localhost:9200/?pretty'
  "name" : "hnG_yFT",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "dk03YftTQrO6qH0iLxSkHg",
  "version" : {
    "number" : "5.4.0",
    "build_hash" : "780f8c4",
    "build_date" : "2017-04-28T17:43:27.229Z",
    "build_snapshot" : false,
    "lucene_version" : "6.5.0"
  "tagline" : "You Know, for Search"

Testing Elasticsearch Installation

These steps in this article are tested on Mac OS. If you want to install it on a production box running Linux, you can use Ansible playbook for Elasticsearch. It is tested on Ubutu 14.04.

Useful Tips

Where is the Elasticsearch home directory?

curl "localhost:9200/_nodes/settings?pretty=true"
  "ok" : true,
  "cluster_name" : "rpcluster",
  "nodes" : {
    "NI-BTti6TxSLbGpJZ8Dhqw" : {
      "name" : "li552-13",
      "transport_address" : "inet[/]",
      "hostname" : "",
      "version" : "0.90.12",
      "http_address" : "inet[/]",
      "attributes" : {
        "master" : "true"
      "settings" : {
        "path.logs" : "/var/log/elasticsearch",
        "" : "/tmp/elasticsearch",
        "path.conf" : "/etc/elasticsearch",
        "" : "/var/lib/elasticsearch",
        "path.home" : "/usr/share/elasticsearch",
        "pidfile" : "/var/run/",
        "script.disable_dynamic" : "true",
        "" : "500ms",
        "transport.tcp.compress" : "true",
        "gateway.recover_after_nodes" : "1",
        "" : "2s",
        "transport.tcp.port" : "9300",
        "" : "800ms",
        "index.indexing.slowlog.threshold.index.trace" : "500ms",
        "discovery.zen.minimum_master_nodes" : "1",
        "http.enabled" : "true",
        "node.master" : "true",
        "index.indexing.slowlog.threshold.index.debug" : "2s",
        "" : "5s",
        "transport.tcp.connect_timeout" : "10s",
        "index.indexing.slowlog.threshold.index.warn" : "10s",
        "" : "200ms",
        "gateway.expected_nodes" : "1",
        "" : "true",
        "" : "rpcluster",
        "http.port" : "9200",
        "bootstrap.mlockall" : "true",
        "index.number_of_replicas" : "1",
        "" : "1s",
        "gateway.type" : "local",
        "gateway.recover_after_time" : "30s",
        "" : "li552-13",
        "" : "false",
        "" : "30s",
        "index.number_of_shards" : "5",
        "" : "500ms",
        "http.max_content_length" : "100mb",
        "" : "10s",
        "" : "5s",
        "name" : "li552-13"

Look at the entry for settings -- path -- home:

"path.home" : "/usr/share/elasticsearch"

Where is elasticsearch.yml?

You can see it in the output as path.conf, this directory has the elasticsearch.yml file.


Related Articles

Ace the Technical Interview

  • Easily find the gaps in your knowledge
  • Get customized lessons based on where you are
  • Take consistent action everyday
  • Builtin accountability to keep you on track
  • You will solve bigger problems over time
  • Get the job of your dreams

Take the 30 Day Coding Skills Challenge

Gain confidence to attend the interview

No spam ever. Unsubscribe anytime.