Last Updated: February 25, 2016
· r3dsm0k3

Browser Exploitation Framework on OSX

As you know BeEF is a framework for exploiting browser.
Here is a guide to install it in Mac,as the original documentation doesnt work with OSX.

Check your ruby version first (Im assuming you have ruby gem,rvm and svn already installed,if not install them first.)

ruby --version

i had 1.8,updated to 1.9 through rvm and made it default.
create a folder for beef and checkout the latest code,

mkdir beef
cd !$
svn checkout beef-read-only
cd beef-read-only
ruby beef

You may see some Load errors,don't be panic..we can easily fix it.
Beef requires some ruby gems,if it is not there inside your system,It will throw load errors,to fix those get what gem is missing and install it using the following command
Lets say you saw one error like ,

site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- ansi (LoadError)
from /Users/r3dsm0k3/.rvm/rubies/ruby-1.9.2-  p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /users/r3dsm0k3/Desktop/stuffhack/beef/beef-read- only/core/loader.rb:23:in `'
from :29:in `require'
from :29:in `require'
from beef:37:in `'

from the first line it is sure that,there is no gem called "ansi"
just install that gem then,

gem install ansi

done, :)
Try running beef again.If it fails,install the missing gem like before.
I had issues with the following gems,

term/ansicolor (
gem install term-ansicolor)

NOTE:for librex, the installation is quite different as beef needs 0.0.52 version of librex,but when you install from gem it will be the latest,so install the corresponding version like
gem install librex --version 0.0.52 --no-rdoc --no-ri

After all your dependencies are fulfilled,run beef.

ruby beef

Enjoy your pwnage,Errr...Pentest :)