Skip to content

Instantly share code, notes, and snippets.

@andrewsmedina
Forked from coolaj86/node_reinstall.sh
Created May 16, 2011 01:27
Show Gist options
  • Save andrewsmedina/973763 to your computer and use it in GitHub Desktop.
Save andrewsmedina/973763 to your computer and use it in GitHub Desktop.
Install Node.JS on Mac OS X or Linux
NUMBER_OF_CPU_CORES=2
BASHRC=~/.profile
# Remove old Node.JS installation
rm ~/local/*/node* -rf
rm ~/.node_libraries -rf
sudo rm /usr/local/*/node* -rf
sudo rm /usr/*/node* -rf
# Install Node.JS
mkdir -p ~/local/{bin,lib,share}
mkdir -p ~/local/share/man
cd ~/
git clone git://github.com/joyent/node.git
cd node
./configure --prefix=~/local
make -j ${NUMBER_OF_CPU_CORES}
make install
# Put node in your path
echo 'PATH=~/local/bin/:${PATH}' >> ${BASHRC}
source ~/.profile
# Install npm
cd ~/
curl http://npmjs.org/install.sh | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment