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

sysctl -- get or set kernel state

sysctl [-n] -a | -A
sysctl [-b|X n] name
sysctl [-b|X n] -w name=value
sysctl [-b|X n] -X

retrieves kernel state and allows processes 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.
-a List all the currently available non-opaque values.
Ignored if one or more variable names are specified on the command line.
-A List ALL MIB variables including opaque variables (which are normally suppressed). format and length are displayed, as well as a hex dump of the first 16 bytes.
Produces identical output to -a El Captian 4/15/16
Differeces in Mac OS High Sierra.
-X displays hex dump
user.cs_path: /usr/bin:/bin:/usr/sbin:/sbin
user.bc_base_max: 0x00000063
user.bc_dim_max: 0x00000800
user.bc_scale_max: 0x00000063
…

-b Output in binary, value only (direct output to file)
-n Show only values, not names. Useful for setting shell variables.

For example, to save the pagesize in variable $psize:

set psize=`sysctl -n hw.pagesize`
-w name=value Sets values.
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 information can only be retrieved by special programs such as ps, systat, and netstat.

Name                  Type    Changable
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
Name                  Type    Changable 
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

Name                  Type    Changable
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
sysctl can get or set debugging variables that have been identified for its display.

sysctl debug
El Capitian 4/14/16

debug.lowpri_throttle_max_iosize: 131072
debug.lowpri_throttle_tier1_window_msecs: 25
debug.lowpri_throttle_tier2_window_msecs: 100
debug.lowpri_throttle_tier3_window_msecs: 500
debug.lowpri_throttle_tier1_io_period_msecs: 15
debug.lowpri_throttle_tier2_io_period_msecs: 50
debug.lowpri_throttle_tier3_io_period_msecs: 200
debug.lowpri_throttle_tier1_io_period_ssd_msecs: 5
debug.lowpri_throttle_tier2_io_period_ssd_msecs: 15
debug.lowpri_throttle_tier3_io_period_ssd_msecs: 25
debug.lowpri_throttle_enabled: 1

debug.bpf_bufsize:      4096
debug.bpf_maxbufsize: 524288
debug.bpf_maxdevices:    256
debug.bpf_wantpktap: 0
debug.bpf_debug: 0

debug.sched: 0
debug.toggle_address_reuse: 0
debug.sys_override_enabled: 1
debug.kextlog: 4083
debug.swd_kext_name: 
debug.swd_delay_type: 
debug.swd_delay_duration: 0

debug.iokit: 0
debug.iotrace: 0
debug.darkwake: 3
debug.noidle: 0
debug.wdtlog: 95013m1/095033m1/095053m1/095073m1/
095093m1/095113m1/095133m1/095153m1/095173m1/095193m1/
095213m1/095233m1/095253m1/095273m1/095293m1/095313m1/
095333m1/095353m1/095374m1/095394m1/095414m1/095434m1/
095454m1/095474m1/095494m1/095514m1/095534m1/095554m1/
095574m1/095594m1/095634m1/095654m1/0
Information about the filesystems that have been compiled into the running system.
sysctl vfs
By default, only filesystems that are actively being used are listed. -A lists all the filesystems compiled into the running kernel.

EXAMPLES

All kernal variables: sysctl kern

Maximum number of processes allowed in the system: sysctl kern.maxproc

clock rate : sysctl kern.clockrate

load average history : sysctl vm.loadavg

swap space usage : sysctl vm.swapusage

Set the maximum number of processes allowed in the system to 1000: sysctl -w kern.maxproc=1000

FILES

/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers

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

SEE ALSO

sysctl(3)

For a detailed description of these variable see sysctl(3).