Skip to content

Instantly share code, notes, and snippets.

@elfacht
Created January 5, 2022 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elfacht/4f2e413510ff43bf14646b54c1662d6f to your computer and use it in GitHub Desktop.
Save elfacht/4f2e413510ff43bf14646b54c1662d6f to your computer and use it in GitHub Desktop.
Install npm without sudo on macOS
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment