3

I created this plist to get Mongo running on startup but it won't fire. I have to run this every time I start up:

launchctl load /Library/LaunchDaemons/org.mongo.mongod.plist

Then it works fine.

Here is /Library/LaunchDaemons/org.mongo.mongod.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>org.mongo.mongod</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/mongo/bin/mongod</string>
        <string>--config=/usr/local/etc/mongod.conf</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
</dict>
</plist>

Thanks

EDIT: Here is the contents of system.log

$ cat /var/log/system.log | grep launch
May  8 06:43:57 localhost com.apple.launchd[1]: *** launchd[1] has started up. ***
May  8 06:43:57 localhost com.apple.launchd[1]: *** Shutdown logging is enabled. ***
May  8 06:44:06 localhost com.apple.launchd[1] (nginx): Unknown key for boolean: NetworkState
May  8 06:44:15 localhost distnoted[67]: assertion failed: 13C1021: liblaunch.dylib + 25164 [38D1AB2C-A476-385F-8EA8-7AB604CA1F89]: 0x25
May  8 06:44:23 Jonahs-iMac.local aosnotifyd[64]: aosnotifyd has been launched
May  8 06:44:39 jonahs-imac com.apple.launchd[1] (0x7fc812f1c4c0.anonymous.nohup[212]): assertion failed: 13C1021: launchd + 73282 [425516B6-9F3E-342F-87B3-EC461EBA6A1A]: 0x0
May  8 06:44:39 jonahs-imac com.apple.launchd[1] (0x7fc812f1c4c0.anonymous.nohup[212]): Switching sessions is not allowed in the system Mach bootstrap.
May  8 06:44:39 jonahs-imac com.apple.launchd[1] (0x7fc812f1c4c0.anonymous.nohup[212]): _vprocmgr_switch_to_session(): kr = 0x44c
May  8 06:44:39 jonahs-imac com.apple.launchd[1] (0x7fc812e50b90.anonymous.nohup[213]): assertion failed: 13C1021: launchd + 73282 [425516B6-9F3E-342F-87B3-EC461EBA6A1A]: 0x0
May  8 06:44:39 jonahs-imac com.apple.launchd[1] (0x7fc812e50b90.anonymous.nohup[213]): Switching sessions is not allowed in the system Mach bootstrap.
May  8 06:44:39 jonahs-imac com.apple.launchd[1] (0x7fc812e50b90.anonymous.nohup[213]): _vprocmgr_switch_to_session(): kr = 0x44c
May  8 06:44:40 jonahs-imac.home launchctl[245]: com.apple.findmymacmessenger: Already loaded
May  8 06:44:41 jonahs-imac com.apple.launchd[1]: System: Could not find requested session: Aqua
May  8 06:44:41 jonahs-imac com.apple.launchd.peruser.501[261]: Background: Aqua: Registering new GUI session.
May  8 06:44:41 jonahs-imac com.apple.launchd[1] (com.wacom.pentablet[252]): Exited with code: 255
May  8 06:44:41 jonahs-imac com.apple.launchd.peruser.501[261] (com.apple.EscrowSecurityAlert): Unknown key: seatbelt-profiles
May  8 06:44:41 jonahs-imac com.apple.launchd.peruser.501[261] (com.apple.ReportCrash): Falling back to default Mach exception handler. Could not find: com.apple.ReportCrash.Self
May  8 06:44:41 jonahs-imac.home launchctl[264]: com.apple.pluginkit.pkd: Already loaded
May  8 06:44:41 jonahs-imac.home launchctl[264]: com.apple.sbd: Already loaded
May  8 06:44:42 jonahs-imac com.apple.launchd[1] (com.wacom.ConsumerTouchDriver.158960[260]): Exited with code: 255
May  8 06:44:42 jonahs-imac com.apple.launchd.peruser.501[261] (com.google.GoogleContactSyncAgent[312]): Exited with code: 2
May  8 06:44:42 jonahs-imac com.apple.launchd.peruser.501[261] (com.apple.iTunesHelper.35584[317]): Spawned and waiting for the debugger to attach before continuing...
May  8 06:44:42 jonahs-imac com.apple.launchd.peruser.501[261] (com.runningwithcrayons.Alfred-2.28016[318]): Spawned and waiting for the debugger to attach before continuing...
May  8 06:44:42 jonahs-imac com.apple.launchd.peruser.501[261] (com.google.Chrome.12000[320]): Spawned and waiting for the debugger to attach before continuing...
May  8 06:44:42 jonahs-imac accountsd[323]: assertion failed: 13C1021: liblaunch.dylib + 25164 [38D1AB2C-A476-385F-8EA8-7AB604CA1F89]: 0x25
May  8 06:44:43 jonahs-imac com.apple.launchd.peruser.501[261] (com.apple.mrt.uiagent[297]): Exited with code: 255
May  8 06:44:44 jonahs-imac.home com.apple.IconServicesAgent[344]: IconServicesAgent launched.
May  8 06:44:46 jonahs-imac.home TabletDriver[308]: Finish launching /Library/Application Support/Tablet/PenTabletDriver.app/Contents/Resources/ConsumerTouchDriver.app
May  8 06:44:47 jonahs-imac.home TabletDriver[308]: Finish launching /Library/Application Support/Tablet/PenTabletDriver.app/Contents/Resources/TabletDriver.app
May  8 06:44:49 jonahs-imac.home Google Chrome Helper[363]: Process unable to create connection because the sandbox denied the right to lookup com.apple.coreservices.launchservicesd and so this process cannot talk to launchservicesd. : LSXPCClient.cp #426 ___ZN26LSClientToServerConnection21setupServerConnectionEiPK14__CFDictionary_block_invoke() q=com.apple.main-thread
  • Is there any related entry in system.log? – nohillside May 8 '14 at 14:10
  • Where would I find that? – jwerre May 8 '14 at 14:17
  • This is probably a stupid question, but is the path of that config file correct? It looks a little odd that mongod is in /usr/local/mongo/bin but the config file is in /usr/local/etc? Only asking because I can't see anything obviously wrong with the plist file. – mjturner May 8 '14 at 14:28
  • See /var/log/system.log, or run sudo grep launch /var/log/system.log directly from Terminal – nohillside May 8 '14 at 15:11
  • 1
    By issuing launchctl load /Library/LaunchDaemons/org.mongo.mongod.plist you load the job into the user launchd instance but at boot time the job is loaded into the system launchd instance. Enter sudo launchctl load /Library/LaunchDaemons/org.mongo.mongod.plist to find out why this fails. – LCC May 8 '14 at 16:35
1

The issue is probably because you don't separate the argument key from the value within ProgramArguments.

Instead of writing it in this way:

<key>ProgramArguments</key>
<array>
    <string>/usr/local/mongo/bin/mongod</string>
    <string>--config=/usr/local/etc/mongod.conf</string>
</array>

You have to write --config and /usr/local/etc/mongod.conf in each discrete line, such as:

<key>ProgramArguments</key>
<array>
    <string>/usr/local/mongo/bin/mongod</string>
    <string>--config</string>
    <string>/usr/local/etc/mongod.conf</string>
</array>

And remember that when you modify your .plist file, you first have to unload it and then load it again in order to activate the launchd.

  • According to GNU getopt(3) he should be fine: A long option may take a parameter, of the form --arg=param or --arg param. – LCC May 8 '14 at 23:39
  • Ya, I have tried it both was; neither successfully. – jwerre May 9 '14 at 3:56
0

I solved this problem by running Adobe Application Manager.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .