0

I'm setting up a developer environment on OSX and want to use homebrew to manage installs. I am going on the premise that my regular dev account should not be an admin account and then I have setup an additional admin account for the purposes of performing homebrew installs. I think this is the safest way to use homebrew and to avoid sudo as per the recommendation. I am now having problems installing node/npm and am wary and hesitant of the changes I need to make to fix it.

(for the purposes of this question, dev account=kramer, admin account=admin).

I installed homebrew using as my admin account.

If I ls my /usr/local/Cellar directory I see:

drwxr-xr-x 2 Kramer admin 68 26 Jul 12:47 /usr/local/Cellar

which shows that only the owner Kramer has write permissions to it.

Then if I ls my /usr/local directory is see:

drwxrwxr-x 18 admin admin 612 26 Jul 12:47 /usr/local

which shows that its owned by admin (and in the admin group).

If I try to install node as Kramer using brew install node:

Error: Permission denied - /usr/local/Library/Locks/node.brewing

If I try to install node as admin (su admin, not sudo) using the same command I get:

Error: Cannot write to /usr/local/Cellar

I want to do this the right way, and not implement hacks. I thought I should be ok to use my admin account any time that I want to install anything with homebrew, and then revert back to my regular account Kramer for everyday coding. Am I wrong about this? Which account should be the owner of /usr/local/Cellar and /usr/local for me to achieve this?

Should /usr/local/Cellar owner be changed to admin (assuming I do installs with the admin account)? Thanks.

1 Answer 1

0

You can totally use one account for dev and homebrew. You don't need sudo for homebrew installation or for further software installation like node or php.

Specifically for node.js you can use https://github.com/tj/n. It installs node binary in /usr/local/bin and it's pretty easy to control/update node.js version with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.