How to keep multiple versions of Elasticsearch on MacOS

Hello Folks,

Hope you are keeping safe!

This article is very short and simple. I was struggling to have multiple versions of Elasticsearch on my local Mac machine. With `homebrew` service, I wasn’t able to install multiple versions of Elasticsearch and I don’t want to move away from brew. So, I have decided to work on the alternate.

Here’s are the steps:

* If you have elasticsearch installed with brew command. Keep it as-is
* Stop elasticsearch service.

$ brew tap homebrew/services
$ brew services list
$ brew services stop elasticsearch-full # that's my case. Yours will be different
==> Successfully stopped `elasticsearch-full` (label: homebrew.mxcl.elasticsearch-full)
# now if you try to curl localhost:9200
$ curl http://localhost:9200
curl: (7) Failed to connect to localhost port 9200: Connection refused
  • Install evm (ElasticSearch Version Manager) from: https://github.com/duydo/evm
  • Install elasticsearch@7.4 with evm install 7.4.0
  • Start elasticsearch: evm start
  • Try hitting the curl request and you should see version 7.4.0
  • If you want to run previous version (that you’ve installed with Homebrew), simply run: evm stop  and then run brew services start elasticsearch-full

Thankful to: https://github.com/duydo/evm

Hope that helps!