Terminal’s command line makes it simple to set permissions for any of your OS X files. Permissions specify access control–who may read, write or execute your files. The chmod command takes two or more arguments, the first is a multi-digit number that specifies your control choices, the rest is a list of files affected by this change.

The multi-digit number is created by summing up the permissions you’d like to apply. Quoting from the OS X manual pages, these numbers are as follows:

4000: (the set-user-ID-on-execution bit) Executable files with this bit set will run with effective uid set to the uid of the file owner. Directories with the set-user-id bit set will force all files and sub-directories created in them to be owned by the directory owner and not by the uid of the creating process, if the underlying file system supports this feature: see chmod(2) and mount(8).
2000: (the set-group-ID-on-execution bit) Executable files with this bit set will run with effective gid set to the gid of the file owner.
1000: (the sticky bit) See chmod(2) and sticky(8).
0400: Allow read by owner.
0200: Allow write by owner.
0100: For files, allow execution by owner. For directories, allow the owner to search in the directory.
0040: Allow read by group members.
0020: Allow write by group members.
0010: For files, allow execution by group members. For directories, allow group members to search in the directory.
0004: Allow read by others.
0002: Allow write by others.
0001: For files, allow execution by others. For directories allow others to search in the directory.

So, to set a file’s permissions to universal read, universal write you must sum up the read attributes and the write attributes for owner, group members and others: 0400 + 0200 + 0040 + 0020 + 0004 + 0002, which equals 0666 or more simply 666:

% touch bar
% chmod 666 bar
% ls -l bar
-rw-rw-rw-   1 ericasad  ericasad  0 Jun  6 08:03 bar