Yesterday, I was running into much frustration installing Elasticsearch on my Mac machine. After a lot of Googling, I patchworked a solution that worked for and want to share it with you.
After installing Elasticsearch with Homebrew and running
elasticsearch, I ran into this issue:
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Unable to access 'path.data' (/usr/local/var/lib/elasticsearch)
Hmm. I googled this line and found that others encountered a similar issue. When I attempted to locate this folder, it did not exist, so I learned that I needed to 1) create it and 2) give myself permission to write into it. I did this by running these two commands:
sudo mkdir /usr/local/var/lib/elasticsearch/ chmod -R $USER /usr/local/var/lib/elasticsearch
After attempting to run elastic search this next time, it worked!
Phew, that worked! I was happy to resume the work I'd been doing. I hope this is helpful to anyone who is experiencing the same issue I had.