How to Install Elasticsearch on macOS

Elasticsearch is a powerful, open-source search and analytics engine that provides real-time data insights. In this tutorial, we will go through the steps to install Elasticsearch on a macOS machine.

Prerequisites

Step 1: Install Java Development Kit (JDK)

  1. Open your terminal.

  2. Check if Java is already installed by typing java -version in the terminal. If Java is already installed, the version number will be displayed. If not, please follow the instructions below to install Java.

  3. Download the Java SE Development Kit (JDK) from the official Oracle website: https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html

  4. After downloading the file, double-click the .dmg file to mount the disk image.

  5. Run the installer by double-clicking the .pkg file and follow the onscreen prompts to finish the installation.

  6. Once installed, verify that Java is installed by typing java -version in the terminal again.

Step 2: Install Elasticsearch

  1. Go to the Elasticsearch website: https://www.elastic.co/start
  2. Click on the "Get started with Elasticsearch" button. This will take you to the download page.
  3. Under the "Download Elasticsearch" section, click on the "Download" button.
  4. Select the version of Elasticsearch that you want to download.
  5. Once downloaded, navigate to where the file is saved and double-click to extract the tar file.
  6. Move the extracted Elasticsearch folder to wherever you want Elasticsearch to be installed. For this tutorial, we will move it to the root directory:
sudo mv ~/Downloads/elasticsearch-7.14.0 /usr/local/elasticsearch

Note: Be sure to replace "7.14.0" with the version number you downloaded.

  1. Change ownership of the Elasticsearch directory to your user account:
sudo chown -R $USER /usr/local/elasticsearch/
  1. Open a terminal window and navigate to the Elasticsearch directory:
cd /usr/local/elasticsearch/
  1. Run Elasticsearch by executing the following command:
./bin/elasticsearch
  1. If Elasticsearch started without issues, you should see the following in the terminal:
[2021-08-25T10:06:20,441][INFO ][o.e.n.Node               ] [YOUR-COMPUTER-NAME] node name [YOUR-COMPUTER-NAME], node ID [nvgTuCdITS2d9Qc-hfJ3qA], cluster name [elasticsearch], roles [transform, data, ml, remote_cluster_client, data_content]
[2021-08-25T10:06:21,072][INFO ][o.e.t.TransportService   ] [YOUR-COMPUTER-NAME] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}

Congratulations! You have successfully installed Elasticsearch on your macOS machine. In the next steps, you can learn how to configure Elasticsearch and integrate it into your projects.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!