-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(mac): Installing kernel extensions using scripts (#1455)
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Kernel extensions | ||
|
||
Installing macOS kernel extensions with `electron-builder` can be done using scripts. | ||
|
||
First, in `package.json`, make sure you're building a package (.pkg) and not the default .dmg: | ||
|
||
```json | ||
"mac": { | ||
"target": "pkg" | ||
} | ||
``` | ||
|
||
Place your script and the kernel extensions in `build/pkg-scripts`, or [define a custom directory](/~https://github.com/electron-userland/electron-builder/wiki/Options#PkgOptions-scripts). Note that the script **must** be called either `preinstall` or `postinstall`. Remember to use ` #!/bin/sh` as the first line in your script. Also, your script must be executable (`chmod +x <filename>`). | ||
|
||
An example script: | ||
```sh | ||
#!/bin/sh | ||
|
||
echo "Unloading and uninstalling old extensions..." | ||
# unload old extensions | ||
sudo kextunload /Library/Extensions/myExt.kext | ||
|
||
# delete old extensions | ||
sudo rm -rf /Library/Extensions/myExtension.kext | ||
|
||
# install new extensions | ||
echo "Installing and loading new extensions..." | ||
sudo cp -R myExt.kext /Library/Extensions/myExt.kext | ||
sudo kextload /Library/Extensions/myExt.kext/ | ||
``` |