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

4 Answers 4

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
    
what if we don't want to use sudo? Will there be permission errors in the future with mongodb? –  Connor Leech Aug 11 at 19:43

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

Had the same problem on mac os x. I solved this by executing sudo -p mkdir data, cd data and after this sudo -p mkdir db. Good luck.

share|improve this answer

Try this one:

mkdir -p data/db

No slash before the data

share|improve this answer

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.