Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


MongoDB error message: Failed to unlink socket file /tmp/mongodb-27017.sock errno:13 Permission denied

Hello there. I installed mongodb and ran it, but keep getting the following message (I've pasted the entire message here including the error):

2016-01-12T12:06:07.438+0100 I CONTROL [initandlisten] MongoDB starting : pid=87821 port=27017 dbpath=/data/db 64-bit host=Jays-iMac.local 2016-01-12T12:06:07.438+0100 I CONTROL [initandlisten] db version v3.0.8 2016-01-12T12:06:07.438+0100 I CONTROL [initandlisten] git version: 83d8cc25e00e42856924d84e220fbe4a839e605d 2016-01-12T12:06:07.438+0100 I CONTROL [initandlisten] build info: Darwin mci-osx108-4.build.10gen.cc 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49 2016-01-12T12:06:07.438+0100 I CONTROL [initandlisten] allocator: system 2016-01-12T12:06:07.438+0100 I CONTROL [initandlisten] options: {} 2016-01-12T12:06:07.438+0100 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:13 Permission denied 2016-01-12T12:06:07.438+0100 I - [initandlisten] Fatal Assertion 28578 2016-01-12T12:06:07.439+0100 I - [initandlisten]

***aborting after fassert() failure

Can anyone help? Thanks.

1 Answer


You could try and run the mongod binary with sudo or su.

If it doesn't help, try deleting the referred file.

And when the 2 steps before don't work -> check the folder permissions with: " ls -l " to see whos the owner of the folder and what permissions are bound to the folder.

And a piece of advice: the standard location for the db data is always so problematic to access - the data is save under "/data/db" by default -> meaning that it's saved on the root folder of your system which can prove a bit problematic -> just like your problem now.... My advice is that you save the data from your database to a folder in the mongo folder:

create a folder = mkdir mongo/data/db

than when you start the mongod binary add " --dbpath mongo/data/db " flag to start command to tell mongo where the data should be stored.

If you still need help, you can add me on skype: nejc.vukovic

Best regards,