diff --git a/.gitignore b/.gitignore
index f9250e37d80..15265ae239f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,16 +1,10 @@
*.iml
.gradle
/local.properties
-/.idea/assetWizardSettings.xml
-/.idea/caches
-/.idea/compiler.xml
-/.idea/gradle.xml
-/.idea/jarRepositories.xml
-/.idea/libraries
-/.idea/modules.xml
-/.idea/navEditor.xml
-/.idea/vcs.xml
-/.idea/workspace.xml
+.idea/*
+!.idea/encodings.xml
+!.idea/codeStyles/Project.xml
+!.idea/codeStyleConfig.xml
app/build
data/build
domain/build
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index f06c82261e6..00000000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 9b6e38d6425..00000000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
diff --git a/scripts/buf_m1_mac_setup.sh b/scripts/buf_m1_mac_setup.sh
new file mode 100644
index 00000000000..5a72a633447
--- /dev/null
+++ b/scripts/buf_m1_mac_setup.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Setup protobuf platform for M1 Mac
+arch_name="$(uname -m)"
+if [ "${arch_name}" = "x86_64" ] && [[ "$OSTYPE" == "darwin"* ]]; then
+ if [ "$(sysctl -in sysctl.proc_translated)" = "1" ]; then
+ echo 'protobuf_platform=osx-x86_64' >> ../oppia-android/local.properties
+ echo 'Added protobuf platform to local properties.'
+ fi
+fi
diff --git a/scripts/setup.sh b/scripts/setup.sh
index 3b48ab248ba..feee46e80ca 100644
--- a/scripts/setup.sh
+++ b/scripts/setup.sh
@@ -25,3 +25,6 @@ bash ../oppia-android/scripts/checkstyle_download.sh
# Download buf
bash ../oppia-android/scripts/buf_download.sh
+
+# Add protobuf platform for M1 Mac
+bash ../oppia-android/scripts/buf_m1_mac_setup.sh