# Unable to install ES 5 (but can ES 2) on macOS Sierra

**URL:** <https://discuss.elastic.co/t/unable-to-install-es-5-but-can-es-2-on-macos-sierra/69119>\
**Category:** Elasticsearch\
**Created:** [December 15, 2016, 6:19am UTC](https://discuss.elastic.co/t/unable-to-install-es-5-but-can-es-2-on-macos-sierra/69119 "2016-12-15T06:19:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gsccheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gsccheng/32/13904_2.png) [@gsccheng](https://discuss.elastic.co/u/gsccheng)\
**Post date:** [December 15, 2016, 6:19am UTC](https://discuss.elastic.co/t/unable-to-install-es-5-but-can-es-2-on-macos-sierra/69119/1 "2016-12-15T06:19:37Z")

</div>

EDIT: This problem is now resolved. It was because of my .bash\_profile.

Hi, I made an SO post here on my problem here: [http://stackoverflow.com/questions/41149796/unable-to-install-elasticsearch-on-mac-sierra-10-12-2?noredirect=1#comment69515723\_41149796](http://stackoverflow.com/questions/41149796/unable-to-install-elasticsearch-on-mac-sierra-10-12-2?noredirect=1#comment69515723_41149796)

When attempting to start Elasticsearch 5.1.1 via

`$ elasticsearch`

I get the output:

`Error: Could not find or load main class -Xms2g`

I've looked into:

1. I read it may be an error in how a class is called? But I'm not exposed to doing that. This [thread](https://discuss.elastic.co/t/java-classloader-not-able-to-load-error-could-not-find-or-load-main-class/25016) doesn't help and isn't really my problem as I'm not installing a plugin.

2. I installed via Homebrew. Here is some output from that:

3. I also tried originally installing via [manually extracting the .tar.gz package](https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html). I at first got some Java permission denied errors, but after running a `chown` to admin for myself I also got this same `Error: Could not find or load main class` type error.

4. I just updated my Java JDK to the latest: 1.8.0\_112 and set my JAVA\_HOME variable to that directory accordingly.

5. The most recent version of Elasticsearch 2 (2.4.3) works. Meanwhile, Elasticsearch v5.0.2 fails.

What can I do to have Elasticsearch properly installed on my Mac?

---

<div class="post-metadata">

**Author:** ![Glen\_Smith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glen_smith/32/111656_2.png) [@Glen\_Smith](https://discuss.elastic.co/u/Glen_Smith)\
**Post date:** [December 16, 2016, 6:37am UTC](https://discuss.elastic.co/t/unable-to-install-es-5-but-can-es-2-on-macos-sierra/69119/2 "2016-12-16T06:37:30Z")

</div>



---

<div class="post-metadata">

**Author:** ![talevy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/talevy/32/44896_2.png) [@talevy](https://discuss.elastic.co/u/talevy)\
**Post date:** [January 27, 2017, 9:12pm UTC](https://discuss.elastic.co/t/unable-to-install-es-5-but-can-es-2-on-macos-sierra/69119/3 "2017-01-27T21:12:24Z")

</div>

I just ran into this and this comment on the same question in SO was correct: [http://stackoverflow.com/a/41562721/5050790](http://stackoverflow.com/a/41562721/5050790)

removing the grep color options solves this problem. Elasticsearch uses grep to construct to command line args for executing
