1.Dd November 14, 2012 
2.Os Darwin
3.Dt KEXTLOAD 8
4.Sh NAME
5.Nm kextload
6.Nd load kernel extensions (kexts) into the kernel
7.Sh SYNOPSIS
8.Nm
9.Op Ar options
10.Op Fl -
11.Op Ar kext Li \&.\|.\|.
12.Sh DESCRIPTION
13The
14.Nm
15program is used to explicitly load kernel extensions (kexts).
16For most kexts,
17.Nm
18must run as the superuser (root).
19Kexts installed under
20.Pa /System/
21with an
22OSBundleAllowUserLoad
23property set to true
24may be loaded via
25.Nm
26by non-root users.
27.Pp
28.Em Notice:
29On Mac OS X 10.6 (Snow Leopard), the developer functionality of 
30.Nm
31has moved to the new program
32.Xr kextutil 8 ;
33all developer-related options have been removed from
34.Nm
35and are no longer recognized.
36On Mac OS X 10.6 (Snow Leopard),
37.Nm
38simply forwards a load request to
39.Xr kextd 8 ,
40which performs all communication with the kernel.
41.Pp
42.Nm
43is a formal interface for kext loading in all versions
44of Darwin OS and Mac OS X.
45Software and installers can rely on its presence
46and invoke it in order to load kexts.
47Note that long options are present as of Mac OS X 10.6 (Snow Leopard).
48.Pp
49Mac OS X 10.6 (Snow Leopard) introduces
50C functions for loading kexts:
51.Xr KextManagerLoadKextWithIdentifier()
52and
53.Xr KextManagerLoadKextWithURL() ,
54which are described in Apple's developer documentation.
55.Pp
56.Sh ARGUMENTS AND OPTIONS
57.Bl -tag -width -indent
58.It Ar kext
59The pathname of a kext bundle to load.
60The kext's plugins are available for dependency resolution.
61Kexts can also be specified by CFBundleIdentifier with the
62.Fl bundle-id
63option.
64.It Fl b Ar identifier , Fl bundle-id Ar identifier
65Look up the kext whose CFBundleIdentifier is
66.Ar identifier
67within the set of known kexts and load it.
68The kext of the highest CFBundleVersion with the given identifier is used;
69in the case of version ties,
70the last such kext specified on the command line is used.
71See the
72.Fl dependency
73and
74.Fl repository
75options for more information.
76.It Fl d Ar kext , Fl dependency Ar kext
77Add
78.Ar kext
79and its plugins to the set of known kexts for resolving dependencies.
80This is useful for adding a single kext from a directory
81while excluding the others.
82See the
83.Fl repository
84option for more information.
85.It Fl h , Fl help
86Print a help message describing each option flag and exit with a success result,
87regardless of any other options on the command line.
88.It Fl q , Fl quiet
89Quiet mode; print no informational or error messages.
90.It Fl r Ar directory , Fl repository Ar directory
91Use
92.Ar directory
93as a repository of kexts.
94This adds to the set of known kexts for resolving dependencies
95or looking up by CFBundleIdentifier when using the
96.Fl bundle-id
97option.
98This is not recursive; only kexts directly within the directory,
99and their plugins, are scanned.
100See also the
101.Fl dependency
102option.
103.It Fl v Li [ 0-6 | 0x#### Ns Li ] , Fl verbose Li [ 0-6 | 0x#### Ns Li ]
104Verbose mode; print information about program operation.
105Higher levels of verbosity include all lower levels.
106You can specify a level from 0-6,
107or a bitmask of flags as a hexadecimal number prefixed with 0x
108(as described in
109.Xr kext_logging 8 Ns No ).
110Because
111.Nm
112messages
113.Xr kextd 8 ,
114to perform the actual work of loading,
115the decimal levels 1-6 generally have little effect.
116You may wish to use
117.Xr kextutil 8
118if you want verbose output about the kext loading operation.
119.Pp
120.It Fl -
121End of all options. Only kext names follow.
122.El
123.Sh EXAMPLES
124To load a kext, run
125.Nm
126and supply a kext bundle name;
127no options are required:
128.Bd -literal -offset "xxx"
129kextload TabletDriver.kext
130.Ed
131.Pp
132Alternatively, you can use the
133.Fl bundle-id
134.Li ( Ns Fl b Ns Li )
135option to specify a kext by its CFBundleIdentifier:
136.Bd -literal -offset "xxx"
137kextload -bundle-id com.mycompany.driver.TabletDriver
138.Ed
139.Pp
140With no additional options
141.Nm
142looks in the extensions directories
143.Li ( Ns Pa /System/Library/Extensions/
144and
145.Pa /Library/Extensions/ Ns Li )
146for a kext with the given CFBundleIdentifier.
147Adding repository directories with the
148.Fl repository
149option or individual kexts with the
150.Fl dependency
151option expands the set of kexts that
152.Nm
153looks among for dependency resolution and for loading by bundle identifier:
154.Bd -literal -offset "xxx"
155kextload -repository /Applications/MyApp.app/Contents/Resources \\
156    TabletDriver.kext
157.Ed
158.Pp
159.Sh FILES
160.Bl -tag -width "/System/Library/Extensions/" -compact
161.It Pa /System/Library/Extensions/
162The standard system repository of kernel extensions
163.It Pa /Library/Extensions/
164The standard repository of non Apple kernel extensions
165.El
166.Sh DIAGNOSTICS
167.Nm
168exits with a zero status if all kexts specified load successfully
169(or are already loaded).
170If any kext fails to load,
171.Nm
172prints an error message for that kext,
173continues trying to load any remaining kexts,
174then exits with a nonzero status.
175.Pp
176For a kext to be loadable, it must be
177valid, authenticated, and all dependencies of the kext must be available and loadable.
178A valid kext has a well formed bundle, info dictionary,
179and an executable built for the running kernel's architecture.
180An authentic kext's component files,
181not including plugins,
182are owned by root:wheel,
183with permissions nonwritable by group and other.
184If your kext fails to load, try using
185.Xr kextutil 8
186to examine the kext for problems.
187.Sh SEE ALSO 
188.Xr kextcache 8 ,
189.Xr kextd 8 ,
190.Xr kextstat 8 ,
191.Xr kextunload 8 ,
192.Xr kextutil 8 ,
193.Xr kext_logging 8
194