Introduction / Why This Matters
File permissions in macOS determine which user or group can read, modify, or execute a specific file or folder. They are absolutely critical for system security and proper software operation. Incorrect permissions can lead to "Access Denied" errors, software malfunctions, or data leaks. This guide will show you how to quickly and safely change permissions using two primary methods: via the command line (more powerful) and through Finder (convenient for simple cases).
Prerequisites / Preparation
- Administrator privileges: To change permissions on files you don't own or in system directories, you'll need an administrator password.
- Access to Terminal: The Terminal app is located in
/Applications/Utilities/or can be found via Spotlight (Cmd+Space). - Understanding basic permissions: Know who the file's owner is (owner, group, others) and what the letters
r(read),w(write),x(execute) mean.
Step 1: Determine Current Permissions
Always check current permissions before making any changes. This helps you understand exactly what needs to be modified.
- Open Terminal.
- Navigate to the directory containing the file or specify the full path. For example:
cd ~/Documents - Run the
ls -lcommand with the filename:
The output will look similar to:ls -l myfile.txt
The string-rw-r--r-- 1 user staff 1234 15 Feb 10:30 myfile.txt-rw-r--r--represents the permissions:-(file type:-for regular file,dfor folder).rw-(owner: read + write).r--(group: read only).r--(others: read only).
Step 2: Change Permissions via Terminal (the chmod command)
This is the most flexible and precise method. The chmod (change mode) command works with numeric (octal) or symbolic modes.
Method A: Symbolic Mode (easier to understand)
Use the characters u (user/owner), g (group), o (others), a (all) and the operators + (add), - (remove), = (set exactly).
- Add execute permission (
x) for the owner:chmod u+x script.sh - Remove write permission (
w) from group and others:chmod go-w important.doc - Give full permissions (rwx) to owner, read and execute to group and others:
chmod u=rwx,go=rx program
Method B: Octal (Numeric) Mode (fast and precise)
Assign a three-digit number to each class (owner, group, others), where:
4= read (r)2= write (w)1= execute (x)0= no permissions
The sum of these values gives the final digit. The most common example is 755:
7(4+2+1) = rwx for owner.5(4+0+1) = r-x for group.5(4+0+1) = r-x for others.
Example commands:
# Standard permissions for an executable script/program
chmod 755 myscript.sh
# Only the owner can read and write (private file)
chmod 600 private.key
# Full access for everyone (use with caution!)
chmod 777 public_share.txt
Changing permissions on a folder recursively: Add the -R (recursive) flag to apply permissions to all nested files and folders.
chmod -R 755 my_folder/
⚠️ Important: Recursively changing permissions, especially to
777, can create serious security vulnerabilities. Apply only to specific shared folders.
Step 3: Change Permissions via Finder (Graphical Interface)
This method is suitable for simple operations and doesn't require memorizing codes.
- In Finder, locate the desired file or folder.
- Right-click on it (or Control-click) and select "Get Info". Alternatively, select the file and press
Cmd+I. - At the bottom of the "Get Info" window, find the "Sharing & Permissions" section.
- Click the lock icon in the bottom-right corner and enter an administrator password to make changes.
- You'll see a list of users and groups. Next to each name is a dropdown menu with permission levels:
- Read & Write — full access.
- Read Only — view and copy.
- Write Only — only add/modify (for folders like "Trash").
- No Access — complete denial.
- Select the appropriate access level for each user/group.
- To apply permissions to all enclosed items (if it's a folder), click the "Apply to enclosed items" button. This option is not available for all file types and may not work for some system files.
Step 4: Verify the Result
After making changes, ensure everything works as intended.
- Via Terminal: Run
ls -l <file>again and compare the permission string to your desired setting. - Via Finder: The "Get Info" window should display the new settings.
- Practical test: Try performing an action as another user (or in Guest mode)—open, edit, or run the file. It should succeed or be denied according to the new permissions.
Common Issues
"Operation not permitted" error in Terminal
- Cause: You're trying to change permissions on a system file or folder protected by System Integrity Protection (SIP). You may also lack ownership rights.
- Solution:
- Ensure you're not trying to modify files in
/System,/usr(except/usr/local),/bin,/sbin, and other protected directories. SIP does not interfere with user files. - If you need to change permissions on a system file (e.g., for development), you'll need to temporarily disable SIP. Do this via Recovery Mode (restart, hold
Cmd+R), launch the Terminal utility, and runcsrutil disable. After rebooting, change the permissions, then re-enable SIP (csrutil enable) for security. - Check if you are the file's owner (
ls -lshows your name in the third column). If not, usesudo chownto change ownership before runningchmod.
- Ensure you're not trying to modify files in
Permissions in Finder don't change for some files
- Cause: Finder uses extended attributes (ACLs) and may not display all details set via
chmod. For system files or files owned byroot, the Finder interface is limited. - Solution: Use Terminal and the
chmodcommand for full control. To view ACLs, usels -le.
File stops working after permission change
- Cause: Some programs (especially executables or scripts) require specific permissions. For example, a script without execute (
x) permission won't run. - Solution: Set the permissions recommended by the software vendor. Often, executables use
755, configuration files644. If unsure, check documentation for your specific program.
Recursive change (chmod -R) affected wrong files
- Cause: An error in the path or using
*without accounting for hidden files (starting with.). - Solution: Always verify the path before running
chmod -R. Usels -lato display all files, including hidden ones. To change permissions only on files (not folders), combine withfind:find /path/ -type f -exec chmod 644 {} \;.