Created
May 1, 2012 16:27
-
-
Save tbranyen/2569416 to your computer and use it in GitHub Desktop.
Easily install new or old versions of Node.js on an OS X machine.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Copyright 2012, Tim Branyen @tbranyen <[email protected]> | |
# Dual licensed under the MIT and GPL licenses. | |
# | |
# Easily install new or old versions of Node.js on an OS X machine. | |
# | |
# Install: curl -o /usr/local/bin/install_node https://gist.github.com/raw/2569416/install_node.sh | |
# chmod +x /usr/local/bin/install_node | |
# | |
# Usage: install_node 0.6.16 | |
# | |
# Specify the version as the single argument, if you want to customize the | |
# cache directory, you can modify this file or prefix with: | |
# | |
# DIR=~/.cache install_node 0.6.16 | |
# | |
# Configure the installer cache directory | |
DIR=~/.node | |
# Configure the target harddisk to install to | |
TARGET=/Volumes/Macintosh\ HD | |
# Pass version in as an argument | |
VER=$* | |
# If install file doesn't already exist, fetch it first | |
if [ ! -f ~/.node/$VER.pkg ]; then | |
# Fetch the package into a hidden directory | |
curl --create-dirs -o $DIR/$VER.pkg \ | |
http://nodejs.org/dist/v$VER/node-v$VER.pkg | |
fi | |
# Invoke the installer | |
sudo installer -pkg $DIR/$VER.pkg -target $TARGET |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
L34 should be
-target $TARGET
This script is rad btw.