Is there a way to install node.js on mac os without sudo?

681 views
Skip to first unread message

Alexey Petrushin

unread,
Mar 20, 2012, 8:31:57 AM3/20/12
to nod...@googlegroups.com
As far as I know there's currently 2 ways to install node on mac:

1. As `brew install node`. It doesn't require sudo, but npm sometimes doesn't work as expected (can't find some packages).
2. As installer from nodejs.org. It works but requires sudo. Maybe there's any way to install it without sudo?

Thanks.

Chris Rhoden

unread,
Mar 20, 2012, 8:55:27 AM3/20/12
to nod...@googlegroups.com
Alexey,

What issues do you have with npm and homebrew?

Homebrew installs a version of node which does not include npm, but you can install npm afterwards manually. And I haven't seen an issue with using it this way - can you elaborate on the issue?

FWIW, the only issue is of folder permissions. You can download the source and compile it with whatever prefix you like (maybe /usr/local/ so it lives alongside homebrew).

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en



--
chrisrhoden

Brian Kaney

unread,
Mar 20, 2012, 9:44:39 AM3/20/12
to nod...@googlegroups.com
You could also try nvm (https://github.com/creationix/nvm).

--
Brian

deitch

unread,
Mar 20, 2012, 10:58:39 AM3/20/12
to nod...@googlegroups.com
Go for the installer, but change your node dir to ~/local. That is what I do, it works very well. TJ's amazing n also picks up on it.

After you download, do

./configure --prefix=~/local
make
make install

and it will do the right thing. It is available here https://github.com/joyent/node/wiki/Installation

You should probably also add ~/local/bin to your PATH after.

Chris Rhoden

unread,
Mar 20, 2012, 11:07:35 AM3/20/12
to nod...@googlegroups.com
On Tue, Mar 20, 2012 at 10:58 AM, deitch <a...@deitcher.net> wrote:
Go for the installer, but change your node dir to ~/local. That is what I do, it works very well. TJ's amazing n also picks up on it.

This is the source, not the installer. I have already addressed this.

If you use homebrew, the /usr/local/ directory will 1) already be in PATH and 2) already be writable by your account. Thus, you can do

./configure --prefix=/usr/local
make
make install

as I suggested in my first reply.
--
chrisrhoden

Alexey Petrushin

unread,
Mar 20, 2012, 11:08:51 AM3/20/12
to nod...@googlegroups.com
Thanks, for answers. I installed it without 'sudo' by installing from sources via 'make install', it seems that it works ok.

> Homebrew installs a version of node which does not include npm, but 
> you can install npm afterwards manually. And I haven't seen an issue 
> with using it this way - can you elaborate on the issue?
For some reason it didn't seen packages installed globally. I don't know what was the cause, but after removing it and installing it from official osx installer this problem disappeared.

Jorge

unread,
Mar 20, 2012, 11:18:18 AM3/20/12
to nod...@googlegroups.com

Yes, there's no need to install it as su, I always do a `./configure --prefix=~/I_put_binarios_here_you_can_put_any_other_folder_you_want`, then `make install`, and don't forget to add that path to your PATH environment variable by editing the ~/.profile file: `pico ~/.profile`
--
Jorge.

DrBloodmoney

unread,
Mar 20, 2012, 8:43:12 PM3/20/12
to nod...@googlegroups.com

I've been doing what Ryan Dahl recommended [1]. It's been working just fine.

[1] http://blog.nodejs.org/2011/04/04/development-environment/

Mihai Tomescu

unread,
Mar 21, 2012, 11:29:49 AM3/21/12
to nod...@googlegroups.com
I also use nvm and it's great for handling multiple versions of node.
Reply all
Reply to author
Forward
0 new messages