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.

SYSCTL(8)                 BSD System Manager's Manual                SYSCTL(8)

     sysctl -- get or set kernel state

     sysctl [-bn] name ...
     sysctl [-bn] -w name=value ...
     sysctl [-bn] -a
     sysctl [-bn] -A
     sysctl [-bn] -X

     The sysctl utility retrieves kernel state and allows processes with appropriate privilege to set kernel
     state.  The state to be retrieved or set is described using a ``Management Information Base'' (``MIB'')
     style name, described as a dotted set of components.

     The following options are available:

     -A      List all MIB variables including opaque variables (which are normally suppressed).  The format
             and length are printed, as well as a hex dump of the first sixteen bytes of the value.

     -a      List all the currently available non-opaque values.  This option is ignored if one or more
             variable names are specified on the command line.

     -b      Force the value of the variable(s) to be output in raw, binary format.  No names are printed
             and no terminating newlines are output.  This is mostly useful with a single variable.

     -n      Show only variable values, not their names.  This option is useful for setting shell variables.
             For instance, to save the pagesize in variable psize, use:

                   set psize=`sysctl -n hw.pagesize`

     -w name=value
             Used to set values.  The MIB name ( name ) followed by an equal sign and the new value ( value
             ) to be used.

     -X      Same as -A, but prints a hex dump of the entire value instead of just the first few bytes.

     If just a MIB style name is given, the corresponding value is retrieved.

     The information available from sysctl consists of integers, strings, and tables.  The tabular informa-tion information
     tion can only be retrieved by special purpose programs such as ps, systat, and netstat.  The string and
     integer information is summarized below.  For a detailed description of these variable see sysctl(3).
     The changeable column indicates whether a process with appropriate privilege can change the value.

     Name                            Type          Changeable
     kern.ostype                     string        no
     kern.osrelease                  string        no
     kern.osrevision                 integer       no
     kern.version                    string        no
     kern.maxvnodes                  integer       yes
     kern.maxproc                    integer       yes
     kern.maxfiles                   integer       yes
     kern.argmax                     integer       no
     kern.securelevel                integer       raise only
     kern.hostname                   string        yes
     kern.hostid                     integer       yes
     kern.clockrate                  struct        no
     kern.posix1version              integer       no
     kern.ngroups                    integer       no
     kern.job_control                integer       no
     kern.saved_ids                  integer       no
     kern.link_max                   integer       no
     kern.max_canon                  integer       no
     kern.max_input                  integer       no
     kern.name_max                   integer       no
     kern.path_max                   integer       no
     kern.pipe_buf                   integer       no
     kern.chown_restricted           integer       no
     kern.no_trunc                   integer       no
     kern.vdisable                   integer       no
     kern.boottime                   struct        no
     vm.loadavg                      struct        no
     vm.swapusage                    struct        no
     machdep.console_device          dev_t         no
     net.inet.ip.forwarding          integer       yes
     net.inet.ip.redirect            integer       yes
     net.inet.ip.ttl                 integer       yes
     net.inet.icmp.maskrepl          integer       yes
     net.inet.udp.checksum           integer       yes
     hw.machine                      string        no
     hw.model                        string        no
     hw.ncpu                         integer       no
     hw.byteorder                    integer       no
     hw.physmem                      integer       no
     hw.usermem                      integer       no
     hw.memsize                      integer       no
     hw.pagesize                     integer       no
     user.cs_path                    string        no
     user.bc_base_max                integer       no
     user.bc_dim_max                 integer       no
     user.bc_scale_max               integer       no
     user.bc_string_max              integer       no
     user.coll_weights_max           integer       no
     user.expr_nest_max              integer       no
     user.line_max                   integer       no
     user.re_dup_max                 integer       no
     user.posix2_version             integer       no
     user.posix2_c_bind              integer       no
     user.posix2_c_dev               integer       no
     user.posix2_char_term           integer       no
     user.posix2_fort_dev            integer       no
     user.posix2_fort_run            integer       no
     user.posix2_localedef           integer       no
     user.posix2_sw_dev              integer       no
     user.posix2_upe                 integer       no

     The sysctl program can get or set debugging variables that have been identified for its display.  This
     information can be obtained by using the command:

           sysctl debug

     In addition, sysctl can extract information about the filesystems that have been compiled into the run-ning running
     ning system.  This information can be obtained by using the command:

           sysctl vfs

     By default, only filesystems that are actively being used are listed.  Use of the -A flag lists all the
     filesystems compiled into the running kernel.

     For example, to retrieve the maximum number of processes allowed in the system, one would use the

           sysctl kern.maxproc

     To set the maximum number of processes allowed in the system to 1000, one would use the request:

          sysctl -w kern.maxproc=1000

     Information about the system clock rate may be obtained with:

           sysctl kern.clockrate

     Information about the load average history may be obtained with:

           sysctl vm.loadavg

     Information about the system's swap space usage may be obtained with:

           sysctl vm.swapusage

     <sys/sysctl.h>        definitions for top level identifiers, second level kernel and hardware identi-fiers, identifiers,
                           fiers, and user level identifiers
     <sys/socket.h>        definitions for second level network identifiers
     <sys/gmon.h>          definitions for third level profiling identifiers
     <vm/vm_param.h>       definitions for second level virtual memory identifiers
     <netinet/in.h>        definitions for third level Internet identifiers and fourth level IP identifiers
     <netinet/icmp_var.h>  definitions for fourth level ICMP identifiers
     <netinet/udp_var.h>   definitions for fourth level UDP identifiers


     sysctl first appeared in 4.4BSD.

BSD                            October 11, 2013                            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.