Software⏱️ 2 min read📅 2026-05-31

How to Fix: gradlew: Permission Denied

Gradle permission denied error resolved by running gradlew with sudo.

Quick Answer: Run gradlew with sudo to resolve the permission denied error.

The 'Permission Denied' error when running Gradle on a Mac is often caused by the current user not having sufficient permissions to execute the script. This can be due to various reasons, such as the system's security settings or the current user's group membership.

🔍 Why This Happens

  • [Cause]

🛠️ Step-by-Step Verified Fixes

Method 1: Change Ownership of the Script

  1. Step 1: Open Terminal and navigate to the project directory where Gradle is located.

Method 2: Run as Root User

  1. Step 1: Open Terminal and run the following command to switch to the root user: `sudo su -

Method 3: Grant Execute Permissions on the Script File

  1. Step 1: Open Terminal and navigate to the project directory where Gradle is located.

Method 4: Use the `chmod` Command

  1. Step 1: Open Terminal and run the following command to grant execute permissions on the Gradle script file: `chmod +x gradlew

💡 Conclusion

By applying one of these methods, you should be able to resolve the 'Permission Denied' error and successfully run Gradle on your Mac.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions