Elasticsearch For Mac

Modifying the data and logs directory These changes can be done in the elasticsearch.yaml file. These changes are optional, you can leave the defaults that they come with. I prefer having all data stored at one location and logs within the install folder for easy debugging.

  1. Elasticsearch is as a.tar.gz archive for Linux and MacOS. This package is free to use under the Elastic license. It contains open source and free commercial features and access to paid commercial features. Start a 30-day trial to try out all of the paid commercial features.
  2. Installing Kibana for Elasticsearch on OS X Published on December 10, 2015 by Bo Andersen The first thing you have to do in order to install Kibana for Mac OS X, is to download Kibana. Kibana can be downloaded here in your browser or by running the below command in your terminal.
  3. The installation matrix for the ELK Stack (Elasticsearch, Logstash and Kibana) is extremely varied, with Linux, Windows and Docker all being supported. For development purposes, installing the stack on Mac OS X is a more frequent scenario. More on the subject: Securing the ELK Stack with Nginx.
  • Using Homebrew
  • Manual Elasticsearch Installation

When installing applications in a Unix-based operating system like OS X occasionally issues may arise. The reasons can range from missing dependencies that the new application relies on to incompatible versions of existing libraries and packages.

In this tutorial, we’ll explore two methods to help you properly install Elasticsearch on OS X.

Using Homebrew

Most OS X users should be familiar with Homebrew (often simply called brew). Homebrew is a basic package manager utility for OS X that allows for simple installation of other applications while Homebrew takes care of all the messy stuff in the background. For this reason, it is highly recommended that you use Homebrew to help you install Elasticsearch (or many other packages you may desire down the road).

Installing Homebrew

If you don’t have Homebrew already installed, you can easily install it by following the instructions on the official homepage. As of the time of writing, this involves simply executing the below command in a terminal prompt, then following the on-screen instructions as necessary:

Brewing the Elasticsearch Formula

With Homebrew installed, you can then execute a few brew commands to quickly install Elasticsearch and all the appropriate dependencies your system will need:

Mac

Elasticsearch Format Version Is Not Supported

Manual Elasticsearch Installation

If you need to manually install Elasticsearch, things become significantly more complicated, but it’s still possible if Homebrew won’t work for you.

Install Java

If you haven’t done so recently, start by installing/updating Java on your system. If you plan to do development with Elasticsearch, get the JDK, otherwise the JRE will suffice. Both can be obtained from the official downloads page.

Get Elasticsearch

Download the latest release version of Elasticsearch from the official downloads page. Typically for OS X users you’ll want the tar.gz file.

Copy the file into your preferred installation directory, then extract it. If working in a terminal, you can extract a tar.gz file using the tar -xvf [filename] command:

Modify Your .bash_profile Variables

Next, open the .bash_profile file in your home directory with your favorite text editor:

Within the profile you need to add/modify some export lines to indicate the appropriate environment variables in order for Elasticsearch to function. Your file may have some of these present, and the values may be different, so double-check the values as necessary:

  • The ES_HOME variable indicates the directory you installed (extracted) the elasticsearch.tar.gz file into.
  • JAVA_HOME is the home installation directory of your Java package (either JDK or JRE). Verify your own path and modify this variable if necessary.
  • PATH is, of course, the standard PATH variable that tells OS X where to find many executables. In this case, the export line is effectively adding onto the existing PATH variable so the system can find where Elasticsearch and Java are located.

Note: Be sure to close your terminal and open a new terminal window so that the PATH variable will be properly updated.

Use Elasticsearch

Finally, you’re able to run Elasticsearch from the terminal window by simply executing the elasticsearch command:

gistfile1.txt
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep elasticsearch
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl remove homebrew.mxcl.elasticsearch
pkill -f elasticsearch
rm -f ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
brew uninstall elasticsearch
# double check existence
ls -al /usr/local/bin/elasticsearch*
ls -al ~/Library/LaunchAgents

commented Dec 15, 2015

Note to self: I followed this in order to cleanly upgrade from 090 to 2.x and since I had incompatible index mappings I needed to delete all the data before I was able to cleanly start the newer version.

commented Jan 6, 2016

Same things Here.
To find your data just brew info elasticsearch and check where the data folder is stored.

commented Feb 29, 2016

Thanks ... nice commands.
All worked well but in my case i installed ES 2.2 and then downgraded to 1.7 and when i do

commented Dec 9, 2019

Just wanted to add one more thing after uninstall elasticsearch/logstash/kibana with above commands, please remove those directories from /usr/local/etc and then try to install them from scratch again. Above commands work well to uninstall but without removing ELK directories it will not allow user to reinstall ELK stack properly.

commented Dec 28, 2019

Elasticsearch For Mac Shortcut

I had to remove data, logs, plugins and config for brew elasticsearch to work properly

rm -rf /usr/local/var/lib/elasticsearch/
rm -rf /usr/local/var/log/elasticsearch/elasticsearch_account.log
rm -rf /usr/local/var/elasticsearch/plugins/
rm -rf /usr/local/etc/elasticsearch/

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment