Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

After installing mongdb on my macbook-pro, it tells me:

If this is your first install, automatically load on login with:

cp /usr/local/Cellar/mongodb/1.6.3-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist

If this is an upgrade and you already have the org.mongodb.mongod.plist loaded:

launchctl unload -w ~/Library/LaunchAgents/org.mongodb.mongod.plist
cp /usr/local/Cellar/mongodb/1.6.3-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist

Or start it manually:

mongod run --config /usr/local/Cellar/mongodb/1.6.3-x86_64/mongod.conf

But after I copy org.mongodb.mongod.plist to ~/Library/LaunchAgents, it tells me:

launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist
launchctl: Couldn't stat("/Users/why/Library/LaunchAgents/org.mongodb.mongod.plist"):
Not a directory

And also I can not cd "~/Library/LaunchAgents", but I can ls the directory!

~/Library/LaunchAgents is a strange directory on mac.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Did you make sure that you created the ~/Library/LaunchAgents directory first? You may have just ended up copying /usr/local/Cellar/mongodb/1.6.3-x86_64/org.mongodb.mongod.plist to a file called ~/Library/LaunchAgents

Try ls -la ~/Library/LaunchAgents and see what the output is. It should look like:

[why@why ~]$ ls -la ~/Library/LaunchAgents
total 40
drwxr-xr-x   7 why  why   238 Jan 11 09:47 .
drwx------+ 68 why  why  2312 Sep 28 19:39 ..
-rw-r--r--   1 why  why   543 Jan 11 09:47 org.mongodb.mongod.plist

If instead you see:

[why@why ~]$ ls -la ~/Library/LaunchAgents 
-rw-r--r--  1 why  why  543 Jan 11 09:47 /Users/why/Library/LaunchAgents

Then you copied the MongoDB plist to a file called LaunchAgents. Here's how to remedy that:

rm ~/Library/LaunchAgents
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mongodb/1.6.3-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist
share|improve this answer
    
Good idea. I usually append a / if I want to be sure of copying to a directory - i.e. copy file dir/ then if dir doesn't exist, it wont copy file to a file called called dir –  Steve Folly Jan 12 '11 at 16:03
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.