X
X
The Best Tech Newsletter Anywhere

Join 350,000 subscribers and get a daily digest of news, geek trivia, and our feature articles.

How to Set File Permissions on Mac

macOS Logo

Like all major operating systems, macOS allows you to restrict access to files using a complex set of file permissions. You can set these yourself using the Finder app, or by using the chmod command in your Mac’s terminal. Here’s how.

Setting Mac File Permissions Using Finder

If you want to set the permissions for a file on your Mac without using the terminal, you’ll need to use the Finder app.

You can launch Finder from the Dock at the bottom of your screen. The application is represented by the smiling Happy Mac logo icon.

The Finder icon in the macOS Dock

In a Finder window, you can view and set permissions by right clicking a file or folder and selecting the “Get Info” option.

Right-click a file and press Get Info to access file permissions on macOS

Extensive information about your file or folder can be found in the “Info” window that opens. To set file permissions, however, you’ll need to click on the arrow next to the “Sharing & Permissions” option.

This will display a list of accounts or user groups on your Mac, with access levels shown under the “Privilege” category.

The "Sharing & Permissions" section of the Get Info window for a file on macOS

If the account or user group you want to set permissions for isn’t listed, select the Plus (+) icon at the bottom of the window.

Press the plus icon at the bottom of the Get Info window

Choose the user or group in the selection window and then click the “Select” button. This will add it to the list.

Select a user or user group, then press Select to add that user or group to the list of file permissions on macOS

The access levels are self-explanatory—users with a “Read Only” access level are unable to edit files, but they can access them. If an account is set to the “Read & Write” level, then they can do both.

To edit this for a user or group in the list, click on the arrow next to the existing level for that account or group and then select either “Read Only” or “Read & Write” from the list.

Setting user group permissions for a user on macOS

Permissions are immediately set. Close the “Info” window once you’re done.

Setting Mac File Permissions Using the Terminal

If you’ve ever used the chmod command on Linux, then you’ll be aware of its power. With one terminal command, you can set the read, write, and executable permissions for files and directories.

RELATED: How to Use the chmod Command on Linux

The chmod command isn’t a Linux-only command, however. Like many other Linux terminal commands, chmod dates back to Unix from the 1970s—Linux and macOS both share this heritage, which is why the chmod command is available in macOS today.

To use chmod, open a terminal window. You can do this by pressing the Launchpad icon on the Dock and clicking the “Terminal” option in the “Other” folder.

Press the Launchpad icon on the Dock, then click the "Terminal" option in the "Other" folder to launch the Terminal app

Alternatively, you can use Apple’s built-in Spotlight Search feature to open the Terminal.

Viewing Current File Permissions

To view current permissions for a file, type:

ls -@l file.txt

Replace “file.txt” with your own file name. This will show all user access levels, as well as any extended attributes relevant to macOS.

The ls command at the macOS terminal

File permissions for the file are shown in the first 11 characters output by the ls command. The first character, an en dash (-), shows that this is a file. For folders, this is replaced by a letter (d) instead.

The ls command at the macOS terminal showing files and folders

The next nine characters are split into groups of three.

The first group shows the access levels for the file/folder owner (1), the middle group shows group permissions (2), and the final three shows permissions for any other users (3).

Underlined file permissions using the ls command at the macOS terminal

You’ll see letters here, too, such as r (read), w (write), and x (execute). These levels are always shown in that order, so for instance:

  • --- would mean no read or write access, and the file isn’t executable.
  • r-- would mean the file can be read, but not written to, and the file isn’t executable.
  • rw- would mean the file can be read and written to, but the file isn’t executable.
  • r-x means the file can be read and executed, but not written to.
  • rwx means the file can be read, written, and executed.

If the final character is an at sign (@), then it signifies that the file or folder has extended file attributes relating to security, giving certain apps (like Finder) persistent file access.

This is related in part to new security features introduced in macOS Catalina, although file access control lists (ACLs) have been a Mac feature since macOS X 10.4 Tiger back in 2005.

RELATED: How macOS Catalina's New Security Features Work

Setting File Permissions

To set file permissions, you’ll use the chmodcommand at the terminal. To remove all existing permissions, set read and write access for the user while allowing read access for all other users, type:

chmod u=rw,g=r,o=r file.txt

The u flag sets the permissions for the file owner, g refers to the user group, while o refers to all other users. The use of an equal sign (=) wipes all previous permissions for that category.

In this instance, the file owner is gaining read and write access, while the user group and other users are gaining read access.

The chmod command used at the macOS terminal

You can use a plus sign (+) to add access to a user level. For instance:

chmod o+rw file.txt

This would grant all other users both read and write access to the file.

An alternative use of chmod at the macOS terminal

You can use the minus (-) to remove this instead, for example:

chmod o-rw file.txt

This would remove read and write access for all other users from the file.

Removing permissions from all other users using chmod at the macOS terminal

To wipe, add, or remove user permissions for all users, use the a flag instead. For instance:

chmod a+rwx file.txt

This would grant all users and user groups with read and write access to your file, as well as allow all users to execute the file.


With great power comes great responsibility, and there’s no denying that the chmod command is an extensive and powerful tool to change file permissions on Mac. You can, for instance, replace the letters ( rwx ) with a combination of three (or four) octal digits, up to 777 (for read, write, and execute).

If you want to learn more about it, type man chmod at the terminal to read the full list of available flags and settings.

Ben Stockton Ben Stockton
Ben Stockton is a freelance tech writer from the United Kingdom. In a past life, he was a UK college lecturer, training teens and adults. Since leaving the classroom, he's been a tech writer, writing how-to articles and tutorials for MakeUseOf, MakeTechEasier, and Cloudwards.net. He has a degree in History and a postgraduate qualification in Computing.
Read Full Bio »

The above article may contain affiliate links, which help support How-To Geek.
How-To Geek is where you turn when you want experts to explain technology. Since we launched in 2006, our articles have been read more than 1 billion times. Want to know more?

x

The Best Tech Newsletter Anywhere

Join 350,000 subscribers and get a daily digest of news, comics, trivia, reviews, and more.