Is there a list of available boot-args for darwin / OS X

In OS X you can set boot parameters with

nvram boot-args=[options]

Where the options I know about -v (verbose) -x (safe mode) and arch=x86_64 (boot into 64 bit kernel on 64 bit capable machines).

Are there any others? There doesn't seem to be any documentation.


Solution 1:

There is no official list, the common one are compiled into kernel it-self, other can be parsed by kernel extensions. Here is the list which I've found so far.

General boot options:

  • -v: Always boot the system in Verbose mode without needing to hold CMD-V at startup.
  • -x: Always boot system into Safe Mode without needing to hold Shift at startup.
  • f: Old Safe Mode.
  • -s: Boot the system into Single User mode without needing to hold CMD-S at startup.
  • -F - Ignore Boot File.
  • iog (e.g. iog=0x0)

    This reverses the "Clamshell" mode for Apple's laptop systems, where when you close the display but connect the system to an external monitor and keyboard the system will stay awake. After running this command, when connecting an external monitor, the internal display will be disabled, which can be beneficial in some situations such as those where you are mirroring your desktop but wish to run the external display at a higher resolution than your laptop can run.CNET

  • arch

    Changes how the system boots, either to the 32-bit (i386) or 64-bit (x86_64) kernel. Note that third-party kernel extensions might be 32-bit or 64-bit only.

  • Graphics Mode: VESA Graphics Mode Dimensions.

  • Text Mode: VGA Text Mode Dimensions.
  • Boot Graphics: Graphics or Text Mode.
  • Quiet Boot: Quiet Bootmode.
  • MKext Cache: Mkext cache file.
  • Kernel Cache: Kernel Cache file.
  • rd: Root Device.
  • boot-uuid: Boot UUID.
  • platform: Platform Expert {ACPI}.
  • config: Load alternate config plist (e.g. config=foobar will load /Library/Preferences/SystemConfiguration/foobar.plist instead of com.apple.Boot.plist)x86osx.

  • serverperfmode=1

    On OS X El Capitan 10.11 and later, this enables the performance mode to dedicate additional system resources for server applications.

DTrace:

  • dtrace_dof_mode: Set DTrace DOF modes {0/1/2/3}.
  • DisableFBT: Disable FBT {1}.
  • IgnoreFBTBlacklist: Ignore blacklist of certain critical modules {1}.

BSD:

  • -b: Don't run /etc/rc.boot.
  • -l: Memory leaks logging (osfmk/kern/startup.c).
  • srv: Boot as server {1}.
  • ncl: Number of clusters.
  • nbuf: Number of buffers for BSD.
  • kmem: Kernel memory access {1}.
  • trace: Kernel trace buffer size.
  • msgbuf: Message Buffer.
  • rp: Root path.
  • mcache_flags: Memory cache flags.
  • mbuf_debug: MBuf Debug {1}.
  • initmcl: Init mbuf clusters.
  • socket_debug: Socket debug (net).
  • net_affinity: Net Affinity (net).
  • rte_debug: Route debug (net) {flags}.
  • -rwroot_hack: Mount root read/write.

IOKit:

  • mseg: Max segment.
  • dart: Remove mapper present.
  • io: IO Kit Debug.

Mach:

  • keepsyms: Do not unload KLD/Address-symbol translation {1}.
  • debug: Kernel debug {flags} (e.g. debug=0x14e).

    Enables kernel debugging features that will show you extra information. E.g.

    • 0x01 - Stop at boot time and wait for the debugger to attach
    • 0x02 - Send kernel debugging output to the console
    • 0x04 - Drop into debugger on a nonmaskable interrupt
    • 0x08 - Send kernel debugging information to a serial port
    • 0x10 - Make ddb the default debugger
    • 0x20 - Output diagnostics information to the system log
    • 0x40 - Allow the debugger to ARP and route
    • 0x80 - Support old versions of gdb on newer systems
    • 0x100 - Disable the graphical panic dialog screen
  • nvram_paniclog: commit paniclog to NVRAM {1}.

  • pmsafe_debug: Put CPUs into "safe" power mode {1}.
  • preempt: Set default preemption rate.
  • unsafe: Max unsafe quanta.
  • poll: Max poll quanta.
  • yield: Schedule poll yield shift.
  • idlehalt: Halt idle thread to allow cpu into lowpower mode {1}.
  • panic_io_port: In a panic read from this I/O port {0x0 to 0xffff}.
  • _fpu: Limit boot-time cpu features {387/mmx/sse}.
  • disable high mem/2: prefer high mem}.
  • immediate_NMI: Force immediate NMI debugger {1}.
  • -legacy: Force legacy 32bit mode.
  • lcks: Lock statistics.
  • novmx: No altivec emulation in Rosetta {1}.
  • max_valid_dma_addr: Max valid DMA address.
  • maxbouncepool: Max bounce pool size.
  • maxloreserve: Max low reserve.
  • npvhash: Physical to virtual mapping hash.
  • wpkernel: Write protect kernel {1}.
  • -no_shared_cr3: Disable shared kernel address space for 64 bit users.
  • -pmap_trace: Enable kernel traces for pmap.
  • _panicd_ip: IP of panic server.
  • _router_ip: IP of router.
  • panicd_port: Port of panic server.
  • -zc: Free zone element checking.
  • mtxspin: Mutex spin (ppc).
  • vmmforce: VMM force (ppc).
  • fn: Force nap (ppc) (acpi) {0/1/2}.
  • pmsx: Experimental power management stepper mode (ppc) {1}.
  • ctrc: Set tracing to specific cpu (ppc).
  • tb: Non-default trace buffer size (ppc).
  • wcte: Write combine timer enable (ppc).
  • mcklog: Clear machine check flag (ppc).
  • mcksoft: Machine check software recovery (ppc).
  • ht_shift: Non-default hash table size (ppc) {1}.
  • zsize: Target zone size.
  • colors: Set VM colors.
  • fill: Fill pages.
  • serialbaud: Set serial baud rate.

Boot options from xnu/osfmk/i386/i386_init.c:

  • diag: Diagnostic output.
  • serial: Serial diagnostic console. Support for a serial keyboard and/or console.

  • maxmem

    Maximum memory to use. It limits the addressable memory to the specified amount (e.g. maxmem=32).

  • cpus=1

    Limits the number of active processors in the system to the set level. This might help preserve power, not likely useful for much else unless you are testing and programming.

  • himemory_mode

    It is used to debug large physical memory configurations for over 4GB systems. Modes: 0 - all pages available, 1 - disable high mem, 2 - prefer high mem.

  • immediate_NMI

    Debug support for over 4GB systems by forcing immediate NMI debugger.

  • urgency_notification_abstime

Other:

  • bluetoothHostControllerSwitchBehavior (never/always)

    Tell Bluetooth driver whether to switch to the dongle that you plugged in. To make the external dongle the default even after reboot, use always.

  • smbios: Verbose SMBIOS (AppleSMBIOS.kext) {1}

  • acpi: Debug AppleACPIPlatform {1-8}
  • acpi_level: ACPI Debug Level
  • acpi_layer: ACPI Debug Layer
  • acpi_sleep: ACPI Sleep
  • nvdebug: NVDAResman debug
  • nvrm: NVDAResman
  • ndrv_debug_level: NDRV Debug Level (NVDAResman)
  • pstep: Power Step Debug (ACPI_SMC)
  • hpet: AppleHPET
  • busratio (e.g. busratio=20): It used i7 cpu in 10.5.6, after 10.5.7 it does not needx86osx.

Source: xnu-1228 / Boot Arguments


Usage

For example when you're in Single Mode (CMD-S after the sound at startup), to run into safe mode and verbosely with extra kernel debugging output to the console, try:

sudo nvram boot-args="-x -v debug=0x14e"

To add the argument into existing (without overriding), try:

sudo nvram boot-args="-v $(nvram boot-args 2>/dev/null | cut -f 2-)"

To remove boot arguments, run:

sudo nvram boot-args=""
sudo nvram -d boot-args

Other non-official parameters can be found in kernel binary it-self, e.g.

$ strings /System/Library/Kernels/kernel | grep -C7 maxmem
kernel_early_bootstrap
diag
serial
Serial mode specified: %08X
PE_init_printf
version_variant = %s
version         = %s
maxmem
himemory_mode
himemory_mode: %d
immediate_NMI
urgency_notification_abstime
i386_vm_init
power_management_init
machine_startup

Or check either in Apple source files or on GitHub by searching for PE_parse_boot_argn (which is used to parse the kernel boot arguments).

Solution 2:

Googling for boot-args site:developer.apple.com gives some good resources. E.g.

  • cpus=1 forces the system to only use a single CPU core.
  • srv=1 is set on Xserves and machines that have Mac OS X Server installed, and supposedly changes some kernel tuning parameters for server-friendly operation.
  • _panicd_ip=a.b.c.d Lets you specify the IP address of a panic debug server to write kernel core dumps to.
  • debug=0xH (Where H is a 1-4 digit hexadecimal number) Lets you set kernel debugging flags from this list:

    DB_HALT   0x01 Halt at boot-time and wait for debugger attach (gdb).  
    DB_PRT    0x02 Send kernel debugging printf output to console.  
    DB_NMI    0x04 Drop into debugger on NMI (Command–Power, Command-Option-Control-Shift-Escape, or interrupt switch).  
    DB_KPRT   0x08 Send kernel debugging kprintf output to serial port.  
    DB_KDB    0x10 Make ddb (kdb) the default debugger (requires a custom kernel).  
    DB_SLOG   0x20 Output certain diagnostic info to the system log.  
    DB_ARP    0x40 Allow debugger to ARP and route (allows debugging across routers and removes the need for a permanent ARP entry, but is a potential security hole)—not available in all kernels.  
    DB_KDP_BP_DIS  0x80 Support old versions of gdb on newer systems.  
    DB_LOG_PI_SCRN 0x100 Disable graphical panic dialog.  
    DB_KERN_DUMP_ON_PANIC   0x0400  Causes the kernel to core dump when the system panics.  
    DB_KERN_DUMP_ON_NMI 0x0800  Causes the kernel to core dump when the user triggers an NMI.  
    DB_DBG_POST_CORE    0x1000  Controls the kernel's behavior after dumping core in response to an NMI (DB_KERN_DUMP_ON_NMI). If the user triggers an NMI and this flag is clear, the kernel will dump core and then continue. Conversely, if this flag is set the kernel will dump core and then wait for a debugger connection.  
    DB_PANICLOG_DUMP    0x2000  Controls whether the kernel dumps a full core (if the flag is clear) or simply a panic log (if the flag is set).  
    

Solution 3:

Here are some more:

-f                            Force rebuild extensions cache
-v                            Verbose booting shows debug information
-s                            Boots into single user mode (means only terminal based mode)
-x                            Boots into safe mode
-legacy                       Boots into 32bit instead of 64bit mode
rd=disk0s1                    Force to boot a specific partition on a specific drive (BSD drive notation, means disk0 = physical disk 1). Here disk1 partition 1 is forced to be booted.
Graphics Mode=1024x768x32@75  Forces to boot with a resolution of 1024 x 768 with 32bit colors at 75Hz
Kernel=mach_kernel            Forces to load a specific kernel, helpful for testing of new kernels.
cpus=1                        Force using only 1 CPU core, may help addressing issues
idlehalt=0                    May solve stuttering and shuttering on dualcore CPUs
platform=X86PC                Forces to not use powermanagement (disables ACPI)
platform=ACPI                 Forces to use powermanagement (enables ACPI, but may crash your system)

Solution 4:

The darwin kernel is called "xnu", the best I could do was to grep the source code for what was being looked for.

Example: OS X 10.8.5

https://gist.github.com/reklis/fa26d4e8db62d6eea9ea

Procedure:

Go here (or your OS X version)

http://www.opensource.apple.com/release/mac-os-x-1085/

Download XNU tarball, extract, grep for "parse_boot"

cd xnu; grep -iRn parse_boot .

Solution 5:

Not to forget the immensely useful (if you updated to Lion and want to use your mac in 'closed clamshell mode' with your lid open)

sudo nvram boot-args="iog=0x0"

kudos to: chenga.8

What bothers me, however, is that I find no explanation for that. Why 0x0? Why not 0x1? What does 'iog' stand for anyways?

I should point out that on my macbook it does not work.