Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Ok I don't know any linux command and just trying to follow the instructions in here: http://www.bigspaceship.com/2011/02/installing-mongodb-on-mac/

So I opened the terminal and typed

mkdir -p /data/db

but it said Permission Denied.

What should I do?

share|improve this question
add comment

3 Answers

try this command:

sudo mkdir -p /data/db

sudo executes the command with higher privileges, and will ask for your password before it lets the command be executed.

share|improve this answer
    
Ok cool, now if I type "db" in Spotlight, it will find it...but how about command line? how do I navigate to this folder in Terminal? in DOS forexample we could say CD\DB –  BdotA May 25 '12 at 3:38
    
It is still cd in linux, so cd /data/db To show the contents of the directory you want to use ls instead of dir, so ls /data/db –  Danny May 25 '12 at 3:58
add comment

You do not have permissions to create the directory. As you are trying to run this as your own user, and as I suspect /data/db is hardcoded somewhere, you should be able to do

sudo install -m 0755 -o $USER -d /data/db

This will use super user privileges (sudo) to create two directories (/data, and /data/db) that are owner by your user.

I suggest you do it this way because the rest of the instructions you will still do as your own user.

share|improve this answer
add comment

Try this one:

mkdir -p data/db

No slash before the data

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.