Step 1 : Install Homebrew

Open terminal and paste this command

/bin/bash -c “$(curl -fsSL"

Now copy and paste these commands to add homebrew in .bash_pofile

echo ‘eval “$(/opt/homebrew/bin/brew shellenv)”’ >> /Users/ravikanttyagi/.bash_profile

eval “$(/opt/homebrew/bin/brew shellenv)”

Step 2 : Install Hadoop using HomeBrew

brew install hadoop

After installation is completed verify hadoop path

cd /opt/homebrew/Cellar/hadoop/3.3.3/

Step 3 : Update the HADOOP_OPTS environment variable

Open this file, /usr/local/Cellar/hadoop/3.3.3/libexec/etc/hadoop/ and paste this line at bottom
export HADOOP_OPTS=""

To open the file we can use VS Code Editor
So first open VS Code Editor and press : cmd + shift + p
then type on searh bar : shell and click on install code command in path

Now on terminal just type : code

Step 4 : Update core-site.xml

Open this file, /usr/local/Cellar/hadoop/3.3.3/libexec/etc/hadoop/core-site.xml and update as below.

Step 5 : Update hdfs-site.xml

Open this file, /usr/local/Cellar/hadoop/3.3.3/libexec/etc/hadoop/hdfs-site.xml and update as below.

Step 6 : Update mapred-site.xml

Open this file, /usr/local/Cellar/hadoop/3.3.3/libexec/etc/hadoop/mapred-site.xml and update as below.

Step 7 : Update yarn-site.xml

Open this file, /usr/local/Cellar/hadoop/3.3.3/libexec/etc/hadoop/yarn-site.xml and update as below.

Now open system preferences and open Sharing and select Remote Login

Step 8 : Format HDFS and Start Hadoop

hdfs namenode -format

cd /usr/local/Cellar/hadoop/3.3.3/sbin


Hadoop will start all services and you can test hadoop

For testing Hadoop open browser and type localhost:9870

Note : If you are facing an error hadoop permission denied (publickey password)

So here we need to configure SSH

Run these commands one by one

ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa

cat ~/.ssh/ >> ~/.ssh/authorized_keys

chmod 0600 ~/.ssh/authorized_keys

Now repeat step 8 and that's it