Installing Elasticsearch on Mac OS X

Published on November 30, 2015 by

The first thing you need to do before installing Elasticsearch on OS X, is to ensure that you have at least version 7 of Java installed. This should be the case, but to be sure, open up your Terminal and enter the java -version command. If you see 1.7.X or 1.8.X in the output, then you are good to go.

Downloading Elasticsearch

Now it is time to download Elasticsearch. To do so, either navigate the download page in your browser or run the below command in your terminal. You should download either the .zip or the .tar.gz file.

curl -L -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.1.0/elasticsearch-2.1.0.tar.gz

Be sure to replace the above version with the most recent version!

Extracting the Archive

Next, you need to extract the archive that you just downloaded in the above step. To do so, simply find the file in Finder and double-click on it, or execute the below commands within the terminal.

cd /path/to/archive
tar -zxvf elasticsearch-2.1.0.tar.gz

Again, be sure to replace the version number with the one that you downloaded.

Starting Elasticsearch on OS X

Now that you have successfully downloaded and extracted the archive, it is time to start Elasticsearch on your Mac. In your terminal, make sure that your working directory is the directory where you extracted the archive (you may move this directory around freely). Then run the following commands.

cd bin
./elasticsearch

The second command loads up Elasticsearch, and shortly after executing the above commands, you should begin to see some informational messages being output by Elasticsearch. Congratulations, your cluster is now running on your Mac!

Testing the Installation

To test that you have correctly installed Elasticsearch on OS X, simply open a new Terminal window and run the following command.

curl -X GET http://localhost:9200/

You should now see a JSON response being output in your terminal, indicating that everything is working as intended. Here we make use of cURL and Elasticsearch’s REST API.

As you can see, the installation is very, very easy and straight forward. Job well done!

Featured

Learn Elasticsearch today!

Take an online course and become an Elasticsearch champion!

Here is what you will learn:

  • The architecture of Elasticsearch
  • Mappings and analyzers
  • Many kinds of search queries (simple and advanced alike)
  • Aggregations, stemming, auto-completion, pagination, filters, fuzzy searches, etc.
  • ... and much more!
Elasticsearch logo
Author avatar
Bo Andersen

About the Author

I am a back-end web developer with a passion for open source technologies. I have been a PHP developer for many years, and also have experience with Java and Spring Framework. I currently work full time as a lead developer. Apart from that, I also spend time on making online courses, so be sure to check those out!

Leave a Reply

Your e-mail address will not be published.