Like all major operating systems, macOS allows you to restrict access to files with a complex set of file permissions. You can set these yourself with the Finder app or with the chmod command in your Mac's terminal. Here's how.
Setting Mac File Permissions with Finder
To set the permissions for a file on your Mac without using the terminal, you must 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.
In a Finder window you can view and set permissions by right-clicking on a file or folder and selecting the "Get Info" option ".
Detailed information about your file or folder can be found in the "Info" window that opens . However, to set file permissions, you must click the arrow next to the "Sharing and Permissions" option.
This will display a list of accounts or user groups on your Mac, with access levels under the "Privilege Category.
If the account or user group you want to set permissions for doesn't is listed, select the plus icon (+) at the bottom of the window. 
Choose the user or group in the selection window, then click the "Select" button This will be added to the list.
The access levels are themselves. Explanation: Users with a "Read Only" access level cannot edit files but can access them. If an account is set to "Read & Write" level, they can do both.
To To edit this for a user or group in the list, click the arrow next to the existing level for that account or group, then select "Read Only" or "Read & Write" from the list.
Permissions are set immediately. Close the "Info" window when you're done.
Setting Mac File Permissions Using the Terminal
If you've ever used the chmod command on Linux, you'll be aware of its power. With one terminal command, you can set the read, write and executable permissions for files and folders.
RELATED: How to Use the chmod Command on Linux
chmod Command, however, is not a Linux command. Like many other Linux terminal commands,
chmod from Unix dates back to the 1970s – Linux and macOS both share this legacy, 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 in the Dock and clicking the "Terminal" option in the "Other" folder.
. , you can use Apple's built-in Spotlight search function to open the terminal.
View current file permissions
To view current file permissions, type:
ls - @ l file.txt
Replace "File.txt" with your own file name. This shows all user access levels, as well as all the extended attributes relevant to macOS.
File permissions for the file are shown in the first 11 characters output by the command
ls . The first character, an en dash (
- ), shows that this is a file. For directories this is replaced by a letter (
The following nine characters are split into groups of three.
The first group shows the access levels for the owner of the file / folder (1), the middle group shows group rights (2) and the last three shows rights for all other users (3). 
You will also see letters here such as
w (write) and
x (execute). These levels are always listed in that order, so for example:
---would not mean read or write access, and the file is not executable.
r -the file could be read, but it cannot be written and the file is not executable.
rw-would mean that the file can be read and written, but the file is not executable.
rxmeans that the file can be read and executed, but cannot be written to.
rwxmeans that the file can be read, written and executed.
If the last character is an at sign (
@ ), it means that the file or folder has extended security file attributes, giving some apps (such as Finder) permanent file access.
This is partly related 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 in 2005.
RELATED:  How macOS Catalina New Security Features Work
Set File Permissions
To set file permissions, use the
chmod command on 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
u flag sets the rights for the file owner,
g refers to the user group, while
o refers to all other users. Using an equal sign (
= ) clears all previous permissions for that category.
In this case, the file owner gets read and write access, while the user group and other users get read
You can add a plus sign (
+ ) use to add access to a user level. For example:
chmod o + rw file.txt
This would give all other users both read and write access to the file.
 You can use the minus sign (
- ) to remove it, for example:
chmod o-rw file.txt
This would remove read and write access for all other users of the
To clear user permissions for all users, To add or remove, use the flag
a instead. For example:
chmod a + rwx file.txt
This would give all users and user groups read and write access to your file and allow all users to run the file.
Having great power is a big responsibility, and there's no denying that the
chmod command is a comprehensive and powerful tool to change file permissions on Mac. For example, you can replace the letters (
rwx ) with a combination of three (or four) octal digits, up to 777 (for reading, writing, and executing).
For more information, type
man chmod on the terminal to read the full list of available flags and settings.