Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ok I don't know any linux command and just trying to follow the instructions in here:

So I opened the terminal and typed

mkdir -p /data/db

but it said Permission Denied.

What should I do?

share|improve this question

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
explanation of the 0755 bit… – Micah Stubbs Jul 20 '15 at 23:38

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 – Blake 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 '14 at 19:43

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

You must log in to answer this question.

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