Mac Developer Library Developer


This manual page is for Mac OS X version 10.9

If you are running a different version of Mac OS X, view the documentation locally:

  • In Terminal, using the man(1) command

Reading manual pages

Manual pages are intended as a quick reference for people who already understand a technology.

  • To learn how the manual is organized or to learn about command syntax, read the manual page for manpages(5).

  • For more information about this technology, look for other documentation in the Apple Developer Library.

  • For general information about writing shell scripts, read Shell Scripting Primer.

CHFLAGS(1)                BSD General Commands Manual               CHFLAGS(1)

     chflags -- change file flags

     chflags [-fhv] [-R [-H | -L | -P]] flags file ...

     The chflags utility modifies the file flags of the listed files as specified by the flags operand.

     The options are as follows:

     -f      Do not display a diagnostic message if chflags could not modify the flags for file, nor modify
             the exit status to reflect such failures.

     -H      If the -R option is specified, symbolic links on the command line are followed.  (Symbolic
             links encountered in the tree traversal are not followed.)

     -h      If the file is a symbolic link, change the file flags of the link itself rather than the file
             to which it points.

     -L      If the -R option is specified, all symbolic links are followed.

     -P      If the -R option is specified, no symbolic links are followed.  This is the default.

     -R      Change the file flags for the file hierarchies rooted in the files instead of just the files

     -v      Cause chflags to be verbose, showing filenames as the flags are modified.  If the -v option is
             specified more than once, the old and new flags of the file will also be printed, in octal

     The flags are specified as an octal number or a comma separated list of keywords.  The following key-words keywords
     words are currently defined:

           arch, archived
                   set the archived flag (super-user only)

           opaque  set the opaque flag (owner or super-user only).  [Directory is opaque when viewed through
                   a union mount]

           nodump  set the nodump flag (owner or super-user only)

           sappnd, sappend
                   set the system append-only flag (super-user only)

           schg, schange, simmutable
                   set the system immutable flag (super-user only)

           uappnd, uappend
                   set the user append-only flag (owner or super-user only)

           uchg, uchange, uimmutable
                   set the user immutable flag (owner or super-user only)

           hidden  set the hidden flag [Hide item from GUI]

     As discussed in chflags(2), the sappnd and schg flags may only be unset when the system is in single-user singleuser
     user mode.

     Putting the letters ``no'' before or removing the letters ``no'' from a keyword causes the flag to be
     cleared.  For example:

           nouchg  clear the user immutable flag (owner or super-user only)
           dump    clear the nodump flag (owner or super-user only)

     Unless the -H or -L options are given, chflags on a symbolic link always succeeds and has no effect.
     The -H, -L and -P options are ignored unless the -R option is specified.  In addition, these options
     override each other and the command's actions are determined by the last one specified.

     You can use "ls -lO" to see the flags of existing files.

     The chflags utility exits 0 on success, and >0 if an error occurs.

     ls(1), chflags(2), stat(2), fts(3), symlink(7)

     The chflags command first appeared in 4.4BSD.

     Only a limited number of utilities are chflags aware.  Some of these tools include ls(1), cp(1),
     find(1), install(1), dump(8), and restore(8).  In particular a tool which is not currently chflags
     aware is the pax(1) utility.

BSD                              March 3, 2006                             BSD

Reporting Problems

The way to report a problem with this manual page depends on the type of problem:

Content errors
Report errors in the content of this documentation with the feedback links below.
Bug reports
Report bugs in the functionality of the described tool or API through Bug Reporter.
Formatting problems
Report formatting mistakes in the online version of these pages with the feedback links below.