Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm trying to load an LaunchAgent in ~/Library/LaunchAgents and though, from command line, it "appears" to load... (if I try to load it again it says it's "already loaded".)

But a process for the application isn't running. ps -e | grep mongo shows nothing (well it shows this grep command.

Anyone know how to troubleshoot these kinds of problems?

Only thing I can find is in system.log:

Feb  9 13:15:26 imac com.apple.launchd.peruser.502[130] (homebrew.mxcl.mongodb): Ignored this key: UserName

I'm assuming it's ignoring the UserName because it's being launched from my User directory: ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist. And as per docs this is to be expected.

I can launch the application just fine from terminal: $ /usr/local/bin/mongod

here's the LaunchAgent 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>homebrew.mxcl.mongodb</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/bin/mongod</string>
    <string>run</string>
    <string>--config</string>
    <string>/usr/local/etc/mongod.conf</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>KeepAlive</key>
  <false/>
  <key>UserName</key>
  <string>meltemi</string>
  <key>WorkingDirectory</key>
  <string>/usr/local</string>
  <key>StandardErrorPath</key>
  <string>/usr/local/var/log/mongodb/output.log</string>
  <key>StandardOutPath</key>
  <string>/usr/local/var/log/mongodb/output.log</string>
</dict>
</plist>
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Got it solved. Will leave this question here…in case someone else has similar issue…and in hopes that someone can offer some good ideas for troubleshooting launchd/launchctl in the future.

My problem was I didn't have my mongod.conf file in the right place. As per plist directive launchctl (or is it launchd?) was looking for /usr/local/etc/mongod.conf but couldn't find it, so, it "loaded" mongod but the app never actually started...and there were no errors to that effect…that I could find.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.