How to iterate through every file in one directory using Ruby

There are many ways of doing it the one below is my favorite.

We use Dir.glob – function and we iterate through all directories. This might be useful when you need to remove thousand of .txt files after system recover for instance.

Dir.glob(“**/*.txt”) do |my_text_file| # note one extra “*”
puts “working on: #{my_text_file}…”


How to install tcmalloc and speed up ruby


sudo apt-get install libgoogle-perftools-dev

then you can speed up your ruby by doing the following:

 export RUBY_GC_MALLOC_LIMIT=1000000000
 export RUBY_HEAP_MIN_SLOTS=800000
 export RUBY_FREE_MIN=600000
 export LD_PRELOAD=/usr/lib/

Install rvm Ruby on Rails and Ruby on Kali Linux

It’s not as simple as described on the rvm website. By some reason it’s just does not work on Kali Linux.

1. Clean up your system first

$apt-get autoremove

2.whereis ruby – we will install a new version and overwrite the existing version instead of removing it.

ruby: /usr/bin/ruby /usr/lib/ruby /usr/bin/X11/ruby /usr/share/man/man1/ruby.1.gz

If you still want to remove it by any reason then you can use these commands if you want but it’s not recommended ;). Try do $apt-get remove ruby

If ruby are installed from source then you need to do the following to remove them.

rm -rf /usr/local/lib/ruby
rm -rf /usr/lib/ruby
rm -f /usr/local/bin/ruby
rm -f /usr/bin/ruby
rm -f /usr/local/bin/irb
rm -f /usr/bin/irb
rm -f /usr/local/bin/gem
rm -f /usr/bin/gem

3. apt-get install build-essential zlib1g zlib1g-dev libreadline6 libreadline6-dev libssl-dev

This is for root user installation.

$\curl -L | bash -s -- --ignore-dotfiles --autolibs=0 --ruby

Searching for binary rubies, this might take some time.
No binary rubies available for: debian/Kali_Linux_1/x86_64/ruby-2.1.0.
Continuing with compilation. Please read ‘rvm help mount’ to get more information on binary rubies.
Installing Ruby from source to: /home/ami/.rvm/rubies/ruby-2.1.0, this may take a while depending on your cpu(s)…
ruby-2.1.0 – #downloading ruby-2.1.0, this may take a while depending on your connection…
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100 11.4M  100 11.4M    0     0   397k      0  0:00:29  0:00:29 –:–:–  968k
ruby-2.1.0 – #extracting ruby-2.1.0 to /home/ami/.rvm/src/ruby-2.1.0.
ruby-2.1.0 – #applying patch /home/ami/.rvm/patches/ruby/2.1.0/changeset_r44327.diff.
ruby-2.1.0 – #applying patch /home/ami/.rvm/patches/ruby/GH-488.patch.
ruby-2.1.0 – #configuring…………………………………………….
ruby-2.1.0 – #post-configuration.
ruby-2.1.0 – #compiling…………………………………………………………………………..
ruby-2.1.0 – #installing……………………………
ruby-2.1.0 – #making binaries executable.
ruby-2.1.0 – #downloading rubygems-2.2.2
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100  404k  100  404k    0     0   707k      0 –:–:– –:–:– –:–:–  884k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.0 – #extracting rubygems-2.2.2.
ruby-2.1.0 – #removing old rubygems.
ruby-2.1.0 – #installing rubygems-2.2.2……………
ruby-2.1.0 – #gemset created /home/ami/.rvm/gems/ruby-2.1.0@global
ruby-2.1.0 – #importing gemset /home/ami/.rvm/gemsets/global.gems

This will install latest ruby 2.1.0 in writing this post.

root@amiOs:/home/ami# source /etc/profile.d/
root@amiOs:/home/ami# type rvm | head -n 1
rvm is a function

Yes it’s installed correctly!

This is quite important

root@amiOs:/home/ami# ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]

Ruby is now also installed to the correct version.

Now switch to global and update your gems.

root@amiOs:/home/ami# rvm gemset use global
Using ruby-2.1.0 with gemset global
root@amiOs:/home/ami# gem outdated
bigdecimal (1.2.3 < 1.2.5)
minitest (4.7.5 < 5.2.2)
psych (2.0.2 < 2.0.4)
rake (10.1.0 < 10.1.1)
rdoc (4.1.0 < 4.1.1)
test-unit ( < 2.5.5)
root@amiOs:/home/ami# gem update

Updating installed gems
Updating installed gems
Updating bigdecimal
Fetching: bigdecimal-1.2.5.gem (100%)
Building native extensions.  This could take a while…
Successfully installed bigdecimal-1.2.5
Parsing documentation for bigdecimal-1.2.5
Installing ri documentation for bigdecimal-1.2.5
Installing darkfish documentation for bigdecimal-1.2.5
Done installing documentation for bigdecimal after 1 seconds

$echo “gem: –no-document” >> ~/.gemrc

This is to speed up gem installation as we don’t need docs files.

We will create a gemset now.

root@amios:/home/ami# rvm use ruby-2.1.0@rails4.0 –create (two dashes this need to be –create instead of -create)

It’s time to install Rails

root@amiOs:/home/ami# gem install rails
Fetching: atomic-1.1.14.gem (100%)
Building native extensions.  This could take a while…
Successfully installed atomic-1.1.14
Fetching: thread_safe-0.1.3.gem (100%)
Successfully installed thread_safe-0.1.3
Fetching: tzinfo-0.3.38.gem (100%)
Successfully installed tzinfo-0.3.38
Fetching: multi_json-1.8.4.gem (100%)
Successfully installed multi_json-1.8.4
Fetching: i18n-0.6.9.gem (100%)
Successfully installed i18n-0.6.9
Fetching: activesupport-4.0.2.gem (100%)
Successfully installed activesupport-4.0.2
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: rack-1.5.2.gem (100%)
Successfully installed rack-1.5.2
Fetching: rack-test-0.6.2.gem (100%)
Successfully installed rack-test-0.6.2
Fetching: builder-3.1.4.gem (100%)
Successfully installed builder-3.1.4
Fetching: actionpack-4.0.2.gem (100%)
Successfully installed actionpack-4.0.2
Fetching: activerecord-deprecated_finders-1.0.3.gem (100%)
Successfully installed activerecord-deprecated_finders-1.0.3
Fetching: arel-4.0.2.gem (100%)
Successfully installed arel-4.0.2

after 658 seconds
27 gems installed
root@amiOs:/home/ami# rails
rails new APP_PATH [options]

root@amiOs:/home/ami# rvm gemset list

gemsets for ruby-2.1.0 (found in /home/ami/.rvm/gems/ruby-2.1.0)
=> rails4.0

root@amiOs:/home/ami# rvm gemset use rails4.0
Using ruby-2.1.0 with gemset rails4.0

Well done to you?

Think I can improve it? Post your comments!

SSD Hosting for 5 dollars a month

Super easy Rails deployment with Ubuntu 12.xx

1. Install Ruby Using RVM

$ \curl -L | bash -s stable –ruby

Some info you will get. This will install latest ruby 2.1

No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.0 – #extracting rubygems-2.2.2.
ruby-2.1.0 – #removing old rubygems.
ruby-2.1.0 – #installing rubygems-2.2.2……………
ruby-2.1.0 – #gemset created /usr/local/rvm/gems/ruby-2.1.0@global
ruby-2.1.0 – #importing gemset /usr/local/rvm/gemsets/global.gems…..
ruby-2.1.0 – #generating global wrappers.
ruby-2.1.0 – #gemset created /usr/local/rvm/gems/ruby-2.1.0
ruby-2.1.0 – #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.1.0 – #generating default wrappers.
Creating alias default for ruby-2.1.0.

* To start using RVM you need to run `source /usr/local/rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.

and DO NOT FORGET ABOUT THIS 🙂 otherwise if you type ruby -v nothing will happened.

$source /usr/local/rvm/scripts/rvm

2. Install Node.js – This is very important to make your live easier.

root@amios:/home/ami# apt-get install nodejs
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
dbconfig-common libmcrypt4 php5-mcrypt
Use ‘apt-get autoremove’ to remove them.
The following extra packages will be installed:
libc-ares2 libev4 libv8-
The following NEW packages will be installed:

If you don’t install Node.js, you’ll need to add this to the Gemfile for each Rails application you build:

gem ‘therubyracer’

3. Do some checking

root@amios:/home/ami# ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]

root@amios:/home/ami# gem -v
2.2.2 ( To update to latest version type gem update –system

4. Upgrade to make your PC happy.

root@amios:/home/ami# rvm gemset list

gemsets for ruby-2.1.0 (found in /usr/local/rvm/gems/ruby-2.1.0)
=> (default)

root@amios:/home/ami# rvm gemset use global
Using ruby-2.1.0 with gemset global
root@amios:/home/ami# gem list

root@amios:/home/ami# gem outdated
bigdecimal (1.2.3 < 1.2.5)
minitest (4.7.5 < 5.2.2)
psych (2.0.2 < 2.0.4)
rake (10.1.0 < 10.1.1)
rdoc (4.1.0 < 4.1.1)
test-unit ( < 2.5.5)

oot@amios:/home/ami# gem update
Updating installed gems
Updating bigdecimal…………………..

5. Speed up gem installation if you dont need doc files ???

$ echo “gem: –no-document” >> ~/.gemrc

6. Install your Rails. As everybody recommends create a new gemset with current rails version.++

root@amios:/home/ami# rvm use ruby-2.1.0@rails4.0 –create
ruby-2.1.0 – #gemset created /usr/local/rvm/gems/ruby-2.1.0@rails4.0
ruby-2.1.0 – #generating rails4.0 wrappers.
Using /usr/local/rvm/gems/ruby-2.1.0 with gemset rails4.0
root@amios:/home/ami# gem install rails

Fetching: atomic-1.1.14.gem (100%)
Building native extensions. This could take a while…
Successfully installed atomic-1.1.14
Fetching: thread_safe-0.1.3.gem (100%)
Successfully installed thread_safe-0.1.3
Fetching: tzinfo-0.3.38.gem (100%)
Successfully installed tzinfo-0.3.38
Fetching: multi_json-1.8.4.gem (100%)
Successfully installed multi_json-1.8.4……………..

7. Don’t use beta versions. Always stable and make your life easier!

8. Don’t user root account for developemnt 🙂

9.root@amios: adduser nOObdeveloper or ami 🙂

10. Create a project folder@

ami@amios:~$ cd ~
ami@amios:~$ ls
ami@amios:~$ cd ~
ami@amios:~$ mkdir workspace
ami@amios:~$ mkdir workspace/rails_projects

rvm does not exist ??? wth

ami@amios:~$ source /usr/local/rvm/scripts/rvm (hmmm…. easy to forget /???? )
ami@amios:~$ rvm -v

rvm 1.25.17 (stable) by Wayne E. Seguin , Michal Papis []

ami@amios:~$ ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]

ami@amios:~$ rvm gemset use rails4.0 – you want to use your gemset don’t you ???
Using ruby-2.1.0 with gemset rails4.0

Now you can create your rails applications using gemset per apps

$ mkdir myapp
$ cd myapp
$ rvm use ruby-2.1.0@myapp –ruby-version –create
$ gem install rails
$ rails new .

Finally we run rails new .. We use the Unix “dot” convention to refer to the current directory. This assigns the name of the directory to the new application.

RoR, Sinatra, Padrino and Others: The Power of Ruby Frameworks

RoR, Sinatra,

Padrino and Others: The Power of Ruby Frameworks

This article is an introduction to the power of ruby frameworks. It’s not always easy to pick the right framework for the right work, and in case of ruby there are many frameworks to choose from a good overview should help you to make the right decision.

Some of them are simple and others are complicated. Which one should I choose for a simple web application? I hope you will be able to answer this question yourself at the end.

Getting started

Ruby is a powerful language. It has been there for a while; even so many people still don’t realize how useful and easy it can be. I’ve seen people in the development business switching to Ruby and it’s frameworks after programming for many years in different languages and I think there’s a reason for that. The creator of

Ruby, Yukihiro “Matz” Matsumoto, explained the heart of his language in one sentence:

“Ruby is simple in appearance, but is very complex inside, just like our human body”.

Java or C++ languages are complex to learn and write. You need to fight with their syntax instead using your time to resolve problems. That’s why I recommend having a look at Ruby and trying it! There’s no better way than getting your hands dirty in the code.

Have a good read and pick up the framework of your choice.

Let’s start this article with a short list of Ruby frameworks before we dive deeper into them. Discover and find them yourself on the web:

• Ruby On Rails –

• Sinatra –

• Pardino –

• Cuba –

• Cramp –

• Merb –

And others: Camping, Ramaze, Vintage, Halcyon, Nitro/Og, Wuby, Ruby Waf, Webby.

Prepare yourself for the battle!

First, you need to install Ruby. The best tool to use is

RVM – Ruby Version Manager. Use Linux or Mac OS as your operative system to avoid problems. Open up your terminal and install RVM first.

ami@os ~ $ \curl -L |

bash -s stable –ruby

If installation and configuration were successful, RVM should now load whenever you open a new shell. This can be tested by executing the following command, which should output rvm is a function as shown below.

ami@os ~$ type rvm | head -n 1

rvm is a function

Finally, see if there are any dependency requirements for your operating system by running:

ami@os ~$ rvm requirements

Make sure that everything is installed before proceeding further.

Then install Ruby. The installation process is easy, you need to check which Ruby versions are available and install the latest stable one for best security and performance. You don’t need to specify its number: type in rvm install ruby-1.9.3 and the latest stable version will be installed. If the latest version isn’t available as a package for your distribution, Ruby will be installed from source as shown Listing 1.


Installation of Ruby – 1.9.3-p374- #complete

Use the newly installed Ruby:

ami@os ~ $ rvm use 1.9.3

Using /home/ami/.rvm/gems/ruby-1.9.3-p374

Check if it works correctly by:

ami@os ~$ ruby -v

ruby 1.9.3p374 (2013-01-15 revision 38858) [i686-linux]

ami@os ~ $ which ruby


Optionally, you can set a version of Ruby to use as the default for new shells. Note that this overrides the system ruby:

ami@os ~ $ rvm use 1.9.3 –default

Using /home/ami/.rvm/gems/ruby-1.9.3-p374

Once you got your Ruby installed, you can proceed with framework installation.

Ruby on Rails

To can install Rails, type the following command:

ami@os ~$ gem install rails

The three largest benefits you can expect with Ruby on Rails are:

Quicker launch Sites that would traditionally take 12 weeks to build can commonly be launched inside of 6 weeks with

Ruby on Rails. This timesaving results from several factors: a leaner code-base (fewer lines of redundant code), a modular design (re-using existing components rather than building everything from scratch), and the availability of existing plugins (again, reducing the need to build features from scratch).

Easier changes After the site launch, future modifications to your site (e.g., adding new features, making changes to the data model) can be applied quicker because of the reasons noted above.

Introduction to Ruby/RoR

More cost-effective

Because of the speed with which Rails sites can be built and modified, you spend less money to create and maintain the website – without compromising its quality, performance, or scalability.

RoR has a few disadvantages as well:

• It’s good for small applications due to its being a heavy framework. It contains a lot of features you will never use.

• Static website. You can create a static website in Ruby on Rails but it’s not worth it. Make your life simpler and use Sinatra for this kind of job.

• Blog oriented website. Why reinvent the wheel? WordPress is the right tool to use. If you want to learn more about Ruby or Rails basic concepts, please refer the following links:

Listing 1. Installing Ruby

ami@os ~ $ rvm list known

# MRI Rubies















ami@os ~ $ rvm install 1.9.3

Searching for binary rubies, this might take some time.

No binary rubies available for: debian/wheezy_sid/i386/ruby-1.9.3-p374.

Continuing with compilation. Please read ‘rvm mount’ to get more information on binary rubies.

Installing Ruby from source to: /home/ami/.rvm/rubies/ruby-1.9.3-p374, this may take a while depending on your

ruby-1.9.3-p374 – #downloading ruby-1.9.3-p374, this may take a while depending on your connection…

ruby-1.9.3-p374 – #extracting ruby-1.9.3-p374 to /home/ami/.rvm/src/ruby-1.9.3-p374

ruby-1.9.3-p374 – #extracted to /home/ami/.rvm/src/ruby-1.9.3-p374

ruby-1.9.3-p374 – #configuring

ruby-1.9.3-p374 – #compiling

ruby-1.9.3-p374 – #installing


Sinatra is a very slim web framework; it needs way less memory at runtime than Rails. Also, since there’s less code involved, request processing is probably faster.

That’s why it can be a very appropriate framework for a web service “this simple”. Sinatra is great to use especially if you need to run many instances (e.g. high traffic or many long running requests), it can be an important factor to the number of machines you need to run your web service.

Sinatra is not, however, good for coding large websites as you would spend a lot of your time doing things, which are already implemented in Rails, like database connections.

Sinatra can be installed and run very easily: Listing 2.

Now open up your browser and paste the following

link to see the sinatra output.



To install Padrino, type the following command:

ami@os ~ $ gem install padrino

The best explanation of why you should use Padrino can be found on their website, its installation is explained above and it’s pretty simple. That’s how its creators describe the Padrino framework:

“Many developers fall in love with the simplicity and expressiveness of Sinatra but quickly come to miss a great deal of functionality provided by other web frame-works such as Rails when building non-trivial applications.

Our team has come to love the philosophy of Sinatra which acts as a thin layer on top of rack allowing middleware to do most of the work and enabling additional

complexity only when required. The goal for this framework is to match the essence of Sinatra and make it suitable for increasingly complex

Listing 2. Sinatra installation

ami@os ~ $ gem install sinatra

Fetching: rack-protection-1.3.2.gem (100%)

Fetching: sinatra-1.3.4.gem (100%)

Successfully installed rack-protection-1.3.2

Successfully installed sinatra-1.3.4

2 gems installed


ami@os ~$ touch hi.rb

Once you have created the hi.rb you can put some basic setup on it for sinatra to work.

ami@os ~$ vim hi.rb


require ‘rubygems’

require ‘sinatra’

get ‘/hi’ do

”Hello Sinatra”



Once the file is saved. Run the command below

ami@os ~ $ ruby hi.rb

[2013-02-05 22:45:56] INFO WEBrick 1.3.1

[2013-02-05 22:45:56] INFO ruby 1.9.3 (2013-01-15) [i686-linux]

== Sinatra/1.3.4 has taken the stage on 4567 for development with backup from WEBrick

[2013-02-05 22:45:56] INFO WEBrick::HTTPServer#start: pid=30869 port=4567

applications that require the use of forms, mail delivery, localization, helpers, caching, etc. For our team, coding is an art form and Sinatra best enables this concept because of these core principles:

• Clean

• Compact

• Fast

• Creative

• Concise

The Padrino framework is the perfect solution for your small projects as well as for your larger project requirements!”



Cuba was originally inspired by Rum, a tiny but powerful mapper for Rack applications. It integrates many templates via Tilt, and testing via Cutest and Capybara.

Introduction to Ruby/RoR

It can be installed by running the following command in your terminal:

ami@os ~$ gem install cuba

Cuba has a few advantages:

• Quick and simple

• Similar to Sinatra in some aspects

• Good for small websites with less complexity

And a few disadvantages:

• Small community

• There exist other better or similar frameworks


A different Ruby framework is Cramp, which is de- scribed in the following way:

• Lightweight, minimal and able to handle thousands of open connections simultaneously

• Built in support for HTML5 technologies: WebSock-ets and Server-Sent Events (EventSource)

• Easy Streaming APIs

• Allows Ruby 1.9 + Fibers to prevent asynchronous

callbacks spaghetti

• Seamless Active Record integration

• Rack Middlewares support + Rainbows! and Thin web servers.

Cramp’s advantages are:

• Great for working with large numbers of open connections

• Provides full-duplex bi-direction communication

• High performance

• It’s best for streaming actions of an application; other

actions can be handled with a different framework.

Cramp has a few disadvantages as well:

• Other frameworks perform better

• Small Community

• Lack of guides on the Internet.


Like Ruby on Rails, Merb is an MVC framework. Unlike Rails, Merb is ORM-agnostic, JavaScript library agnos- tic, and template language agnostic, preferring plug-ins

that add in support for a particular feature rather than trying to produce a monolithic library with everything in the core.

Merb’s also thread-safe and was originally engineered to handle multiple file uploads concurrently.

On the Web – Ruby frameworks popularity statistics – Ruby on Rails – Rack a Ruby Web Server Inter- face – Real-Time Web Application Framework – One of the best free tutori- als to learn Ruby on Rails – For a bit of fun, a famous cartoon based on Ruby


It’s main advantages are as follows:

• Speed

• Simple, well documented core

• Lots of features, flexible and extensible

• Generators

• Test and Specs

• Plugins

• Very good documentation.

Merb has just one disadvantage and it’s the fact that it merges into Rails, so, after all, it’s better to stick with Rails.


There are many Ruby frameworks available now in the web and we can expect this list to grow in the future. It’s not easy to choose the best framework for your programming work. While some of them are suitable to use for simple websites, other will work for complex web- sites such as Twitter, which is actually based on Ruby on Rails. The best way is to give every framework a try and play with it. Try to make some simple websites and check their documentation. I’d recommend starting from a simple framework first (here Sinatra seems to be a good choice), and then progress to more complicated one. Ruby on Rails is the most popular Ruby framework these days, so there are many jobs available once you know your way around it. Eventually, the choice is yours.

Nodejs installation on Linux

Installing Node.js via package manager

The packages on this page are maintained and supported by their respective packagers, not the node.js core team. Please report any issues you encounter to the package maintainer. If it turns out your issue is a bug in node.js itself, the maintainer will report the issue upstream.


Node.js is available in official gentoo portage tree. You have to unmask it.

# emerge -aqv --autounmask-write nodejs
# etc-update
# emerge -aqv nodejs


Node.js is available in official repo for Debian Sid(unstable).

For Debian Squeeze, your best bet is to compile node by yourself (as root):

apt-get install python g++ make
mkdir ~/nodejs && cd $_
wget -N
tar xzvf node-latest.tar.gz && cd `ls -rd node-v*`
make install

Linux Mint

How to install node.js on Debian-based Linux distros (Debian, Ubuntu, Mint etc)


Example install:

sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

It installs current stable Node on the current stable Ubuntu. Quantal (12.10) users may need to install the software-properties-common package for the add-apt-repository command to work: sudo apt-get install software-properties-common

As of Node.js v0.10.0, the nodejs package from Chris Lea‘s repo includes both npm and nodejs-dev.

Or, use the configure shell script from for installing node.js.

There is a naming conflict with the node package (Amateur Packet Radio Node Program), and the nodejs binary has been renamed from node to nodejs. You’ll need to symlink /usr/bin/node to /usr/bin/nodejs or you could uninstall the Amateur Packet Radio Node Program to avoid that conflict.

openSUSE & SLE

Node.js stable repos list. Also node.js is available in openSUSE:Factory repository.

Available RPM packages for: openSUSE 11.4, 12.1, Factory and Tumbleweed; SLE 11 (with SP1 and SP2 variations).

Example install on openSUSE 12.1:

sudo zypper ar NodeJSBuildService 
sudo zypper in nodejs nodejs-devel


Node.js is currently being implemented in Fedora 18 and will become a regular part of the distribution starting with Fedora 19.

To try the unstable 0.9.x series with Fedora 18 right now, run:

sudo yum --enablerepo=updates-testing install nodejs npm

Arch Linux

Node.js is available in the Community Repository.

pacman -S nodejs

FreeBSD and OpenBSD

Node.js is available through the ports system.


Development versions are also available using ports

cd /usr/ports/www/node-devel/ && make install clean

or packages on FreeBSD

pkg_add -r node-devel


Using a package

Simply download Macintosh Installer.

Using homebrew:

brew install node

Using macports:

port install nodejs  


Using a package

Simply download Windows Installer.

Using chocolatey to install Node:

cinst nodejs  

or for full install with NPM:

cinst nodejs.install