Monday 9 October 2017

macos - Can't start mongodb by launchctl on OS X Yosemite (10.10.2)


I've installed mongodb 2.4 via homebrew:


brew install homebrew/versions/mongodb24

Then I've made a simlink to the config provided by homebrew:


ln -sfv /usr/local/opt/mongodb24/homebrew.mxcl.mongodb24.plist ~/Library/LaunchAgents

This file contains the following:






Label
homebrew.mxcl.mongodb24
ProgramArguments

/usr/local/opt/mongodb24/bin/mongod
--config
/usr/local/etc/mongod.conf

RunAtLoad

KeepAlive

WorkingDirectory
/usr/local
StandardErrorPath
/usr/local/var/log/mongodb/output.log
StandardOutPath
/usr/local/var/log/mongodb/output.log
HardResourceLimits

NumberOfFiles
1024

SoftResourceLimits

NumberOfFiles
1024




And now I'm trying to start it and get error:


$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb24.plist
/usr/local/Cellar/mongodb24/2.4.12/homebrew.mxcl.mongodb24.plist: Operation not permitted

Seems like there is some problem with permissions. But I'm not sure. How can I fix that?



Answer



I've solved that problem by using brew services. Remove symlink first:


$ rm ~/Library/LaunchAgents/homebrew.mxcl.mongodb24.plist

Install brew services:


$ brew tap gapple/services

Start mongodb:


$ brew services start mongodb24
==> Successfully started `mongodb24` (label: homebrew.mxcl.mongodb24)

That's it!


UPDATE:


Actually, this happens because of tmux. When you do this inside of a tmux session:


$ brew services start redis
/Users/schfkt/Library/LaunchAgents/homebrew.mxcl.redis.plist: Operation not permitted
==> Successfully started `redis` (label: homebrew.mxcl.redis)

$ brew services list
Warning: No user-space services controlled by `brew services` running...

You get the same result: "Operation not permitted". And redis of course is not started.


But everything works fine when you run the same commands not inside of a tmux session:


$ brew services start redis
==> Successfully started `redis` (label: homebrew.mxcl.redis)

$ brew services list
redis started 82912 /Users/schfkt/Library/LaunchAgents/homebrew.mxcl.redis.plist

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...