MacOS – Weird errors in system.log while trying to run .kext

kernel-extensionslogsmacos

First, I don't know if this is the correct place to put this question. Would Serverfault or Stackoverflow be better?

I was running through a tutorial on making Mac Kernel Extensions. I loaded it, and when I did tail -1 /var/log/system.log, it didn't tell me "Hello World!", it said…

parentalcontrolsd[374]: -[ActivityTracker appDidLaunchOrBecomeFront:launched:] [1844:wolfram] -- Got an error when saving MOC: Error Domain=NSCocoaErrorDomain Code=134030 UserInfo=0x36ba10 "An error occurred while saving."

A few things… What does this mean? And am I looking at the right log file? I can pick out that it's the parentalcontrolsd telling me that the ActivityTracker found that some app launched for the user wolfram. Any help?

Here is my code…

#include <libkern/libkern.h>
#include <mach/mach_types.h>

kern_return_t MyKextStart(kmod_info_t *ki, void *d)
{
printf("Hello, World!\n");
return KERN_SUCCESS;
}

kern_return_t MyKextStop(kmod_info_t *ki, void *d)
{
printf("Goodbye, World!\n");
return KERN_SUCCESS;
}

extern kern_return_t _start(kmod_info_t *ki, void *data);
extern kern_return_t _stop(kmod_info_t *ki, void *data);

KMOD_EXPLICIT_DECL(edu.nerd.kext.MyKext, "1.0.0d1", _start, _stop)
__private_extern__ kmod_start_func_t *_realmain = MyKextStart;
__private_extern__ kmod_stop_func_t *_antimain = MyKextStop;
__private_extern__ int _kext_apple_cc = __APPLE_CC__;

Best Answer

Your debug output will be in kernel.log, not system.log. Further, the terminal command kextstat | grep 'MyKext' will tell you whether your kext is loaded.