Install Metasploit 4 on Mac OS X 08-16-2014, 10:54 AM
#1
Hopefully this can help anyone wanting to use Metaslpoit on their Mac.
Install MacPorts
Make sure you have Xcode installed - http://developer.apple.com/tools/xcode/
Download and install the .dmg from MacPorts - http://www.macports.org/
Verify that MacPorts is up to date
$ sudo port selfupdate
Install Ruby 1.9.1
Once MacPorts has been configured, you can install a new version of Ruby and RubyGems with the following command:
$ sudo port install ruby19 +nosuffix
This will install ruby into /opt/local/
For a complete listing of all the files that were installed, run:
$ port contents ruby19
You should verify that your PATH is set correctly such that /opt/local/bin is listed before /usr/bin.
$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
$ which ruby gem
/opt/local/bin/ruby
/opt/local/bin/gem
Install a database (optional)
Some Metasploit Framework functionality requires a database. We support and recommend using postgres. That said, the Metasploit Framework also contains drivers for MySQL.
PostgreSQL:
$ sudo env PATH=/opt/local/lib/postgresql84/bin/:$PATH
$ sudo port install postgresql84-server
$ sudo gem install pg
MySQL:
$ sudo port install mysql5-server
$ sudo gem install mysql
Install and use the Metasploit Framework
Once Ruby and RubyGems have been properly installed, download the Unix tarball from the Metasploit Framework Website and extract it to the directory of your choice. Change into the framework3 directory and execute msfconsole to get started.
Install MacPorts
Make sure you have Xcode installed - http://developer.apple.com/tools/xcode/
Download and install the .dmg from MacPorts - http://www.macports.org/
Verify that MacPorts is up to date
$ sudo port selfupdate
Install Ruby 1.9.1
Once MacPorts has been configured, you can install a new version of Ruby and RubyGems with the following command:
$ sudo port install ruby19 +nosuffix
This will install ruby into /opt/local/
For a complete listing of all the files that were installed, run:
$ port contents ruby19
You should verify that your PATH is set correctly such that /opt/local/bin is listed before /usr/bin.
$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
$ which ruby gem
/opt/local/bin/ruby
/opt/local/bin/gem
Install a database (optional)
Some Metasploit Framework functionality requires a database. We support and recommend using postgres. That said, the Metasploit Framework also contains drivers for MySQL.
PostgreSQL:
$ sudo env PATH=/opt/local/lib/postgresql84/bin/:$PATH
$ sudo port install postgresql84-server
$ sudo gem install pg
MySQL:
$ sudo port install mysql5-server
$ sudo gem install mysql
Install and use the Metasploit Framework
Once Ruby and RubyGems have been properly installed, download the Unix tarball from the Metasploit Framework Website and extract it to the directory of your choice. Change into the framework3 directory and execute msfconsole to get started.

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)