1  stay Github Cloned Metasploit

git clone https://github.com/rapid7/metasploit-framework.git /usr/local/share/metasploit-framework


Metasploit The size of the whole project is 28M many , git clone It's very slow , Hang it up by yourself VPN Go download it , If you don't wait 2 It's over in over an hour .

After cloning , Check metasploit-framework/config In the catalog database.yml Whether there is , If it doesn't exist, copy it database.yml.example And named it database.yml.

stay /.bash_profile( Choose a profile based on your terminal ) Add the following configuration :

export MSF_DATABASE_CONFIG=/usr/local/share/metasploit-framework/config/database.yml


Last , Update profile :

source .bash_profile

2  Installation and configuration PostgreSQL

Use Homebrew install :

brew install postgresql --without-ossp-build


After installation , Enter the following command to initialize PostgreSQL, If an error occurs during initialization , Delete /usr/local/var/postgres, Run the initialization command again :

initdb /usr/local/var/postgres -E utf8


PostgreSQL The start command of :

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start


PostgreSQL Stop command for :

pg_ctl -D /usr/local/var/postgres stop -s -m fast


For the convenience of starting and stopping PostgreSQL, You can add an alias to your profile :

alias start_pgsql='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
alias stop_pgsql='pg_ctl -D /usr/local/var/postgres stop'


Next , start-up PostgreSQL:



Then for Metasploit Add database users and create corresponding Database:

createuser metasploit -P -h localhost
createdb -O metasploit metasploit -h localhost


createuser metasploit -P -h localhost For local users, we created a metasploit Database server host, and create when you need a password .

alike , createdb -O metasploit metasploit -h localhost Created a database , The owner of the database is metasploit.

You can choose your favorite name to create User and Database, Just talk to the following database.yml One to one correspondence .

go back to metasploit-framework/config/ Under the table of contents , open database.yml, Make the following changes :

adapter: postgresql
database: metasploit
username: metasploit
password: < Your password >
port: 5432
pool: 75
timeout: 5



Notice that it's a modification production The next line , No development.

3  Installation and Metasploit dependent Ruby edition

because macOS Self contained ruby Version is 2.0.0, Version below Metasploit The version used .

At present, there are two major problems Ruby The version management tool is Rbenv and RVM, Use it here Ruenv As an example .

Use Homebrew install :

brew install rbenv ruby-build

ruby-build yes rbenv Plug in for , Provides rbenv install The order of , Automatic compilation and installation is realized Ruby、 Easy to manage multiple Ruby Purpose of the version

rbenv After installation , Add the following configuration to your profile :

eval "$(rbenv init -)"

You can go through rbenv To install a specific version of ruby 了 , You can use the following command to list the currently available ruby edition :

rbenv install --list

newest Metasploit The use of Ruby The version is 2.3.1, Enter the following command to install :

rbenv install 2.3.1

ad locum , rbenv It's downloaded from overseas sources , Because of the internal walls ( Do you know ), It's very slow , I can't even download , Taobao image is recommended , Use wget download :

wget -q https://ruby.taobao.org/mirrors/ruby/ruby-2.3.1.tar.bz2 -O ~/ruby-2.3.1.tar.bz2

without wget, use Homebrew install :

brew install wget

Once the download is complete , use rbenv Install the specified package :

env RUBY_BUILD_MIRROR_URL=file://*/ruby-2.3.1.tar.bz2# rbenv install 2.3.1

* The number is replaced by /Users/ Your username .

env RUBY_BUILD_MIRROR_URL=file:// Used to map the specified file URL, Then use # To install 2.3.1 Version of .

Wait a minute , Installation is complete , rbenv Installed versions of Ruby stay ~/.rbenv/versions/ Next , The following will Ruby2.3.1 Set to the default version of the system .

After setting up , Reopen the terminal , Use the following command to view Ruby current version :

ruby --version

Next install bundle, bundle yes rails Inside the frame Gemfile Specified tools for various libraries :

gem install bundle

Note that there , When I get here, I see that I don't have permission sudo Yes , Don't use it here sudo jurisdiction .
Later I gave up , In fact, you can manually specify the installation path
install rvm To configure ruby:

gpg−−keyserverhkp://keys.gnupg.net−−recv−keys409B6B1796C275462A1703113804BB82D39DC0E3curl -sSL https://get.rvm.io | bash -s stable


Report errors :

 WARNING: You have '~/.profile'file, you might want to load it,
2 to do that add the followingline to '/Users/xx/.bash_profile':

Execution in terminal :

echo "source ~/.profile" >> ~/.bash_profile

bundle After installation , Enter into metasploit-framework Under the table of contents , Resolve module package dependencies

bundle install  # No more use rbenv


Bundle Complete

What's going on here is gems They all come from overseas sources , slowly , Can't .

Some people say , I can modify Gemfile The source inside is Taobao source , But the synchronization of Taobao image is performed regularly , Newly released Gem Maybe it's not synchronized that fast , You need to wait a while before you can use .

You can try to change it to Taobao's source , If the prompt cannot find the corresponding source , You have to change back to the original source , otherwise bundle Unable to complete the installation .

stay bundle install In the process of , There may be a problem that a particular version of the module fails to install , If the installation fails , Delete the message indicating that the installation failed gem, As the following commands you :

rm -f ~/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/cache/metasploit-payloads-1.1.24.gem # Need to rvm Installed ruby route 


Congratulations, Yours Metasploit Our environment has been set up .

Final Step: start-up msfconsole

start-up msfconsole You need to start before PostgreSQL, Otherwise, the database cannot be connected .

Then use the following script to say msf Command bulk soft connect to bin Next ( msf Command in metasploit-framework Under the table of contents ):

for MSF in $(ls msf*); do ln -s /usr/local/share/metasploit-framework/$MSF /usr/local/bin/$MSF;done


Input... At the terminal msfconsole start-up Metasploit The user interface :

After the installation, we found that pkg Package installed ##

Reference link :



macOS Platform installation metasploit More articles about

  1. macOS Installation on PECL

    One . brief introduction PECL(The PHP Extension Community Library) yes PHP Extended Repository , by PHP All extensions provide hosting and download services . adopt PEAR(PHP Exten ...

  2. Installation and use of various platforms Docker The difference of

    stay Mac Up operation Docker Use Docker for Mac System requirements Turn on hardware support for virtualization , It can be checked by command :sysctl kern.hv_support OS X 10.10.3 Or higher ...

  3. [Linux practice ] macOS platform Homebrew to update brew update stuck , Perfect solution

    [Linux practice ] macOS platform Homebrew to update brew update stuck , Perfect solution edition 2020.01.05 Abstract : Use brew install [ software package ] When installing the package , Stuck in Upd ...

  4. CentOS 6.x install Metasploit

    Install now Metasploit frame , After the previous package is installed successfully , We need to install some more Metasploit Rely on the Ruby library , The order is as follows : gem install wirble pg sqlite3 msgpac ...

  5. New ipad install Metasploit(New ipad install Metasploit)

    Title:New ipad install Metasploit(New ipad install Metasploit) --2012-09-19 11:35 After the prison break ,Ssh Or terminal Ipad, It's best to lock the screen ...

  6. Xamarin C# Android for Visual Studio Platform installation

    original text :Xamarin C# Android for Visual Studio Platform installation Xamarin Is based on Mono The platform of , At present, there are mainly the following products ( More specifically, see :http://xamarin.com/pr ...

  7. Cordova WP8 Platform installation and deployment

    original text :Cordova WP8 Platform installation and deployment Cordova Is an open source mobile development framework . It allows you to use standard web Technologies such as HTML5. CSS3 and JavaScript Cross platform development , Avoid every move ...

  8. Linux Platform installation MongoDB And use Docker install MongoDB

    One .Linux Platform installation MongoDB MongoDB Provides linux releases 64 Bit installation package , You can download the installation package from the official website . Download address :https://www.mongodb.com/downlo ...

  9. Windows Platform installation configuration mysql database

    Windows Platform installation configuration mysql database author :Eric WeChat :loveoracle11g To download mysql Software https://www.mysql.com/downloads/ https://d ...

Random recommendation

  1. NEC Study ---- modular - tab[ With title ]

    Brief introduction , Default left , Tab Indefinite width ,  “ title ” and “ more ” Can be deleted , Extension classes can be freely combined , Depend on reset.css( Previous modules and layouts all depend on this css) So how does this effect come true ? CSS Code : . ...

  2. DeepLearning The way ( 3、 ... and )MLP

    DeepLearning tutorial(3)MLP Introduction to the principle of multilayer perceptron + Code details @author:wepon @blog:http://blog.csdn.net/u012162613/articl ...

  3. MyBatis(3.2.3) - Configuring MyBatis using XML, Properties

    The properties configuration element can be used to externalize the configuration values into a prop ...

  4. LINUX Operating system character set for special topics

    Original works , come from " Dark blue blog" Blog , Welcome to reprint . Please note the following source when reprinting , Otherwise, the legal liability of copyright will be investigated . Dark blue blog: http://blog.csdn.net/huangyanl ...

  5. UWP You're supposed to know :App File Explorer

    origin If there is a problem with the app on the mobile terminal, check LocalState Folder database files and log files How to view the bandwidth occupied and occupied by the app on the mobile terminal CPU The memory of Introduce [UWP Development of Mvvmlight Practice 7 : How to find devices (Mob ...

  6. EntityFramework6.X And LocalDB&amp;ConnectionString

    LocalDB For developers SQL Server Express Execution mode of , Its installation will replicate and start SQL Server The minimum set of files required by the database engine and using a specific connection string to start the connection , It can be created and opened SQL ...

  7. JS Determine the scroll bar to the bottom , Whether the page has scroll bars

    To determine whether the page scroll bar is on the end , Three attributes need to be understood : scrollHeight: Get a measure of the height of the element's content , Include invisible content in view due to overflow , Straight white dots , Add in the height of the invisible part of the scroll bar . clientHeight ...

  8. Elasticsearch - Scroll

    Scroll Version:6.1 Original English address :Scroll When a search request returns a single page result , have access to scroll API The retrieval volume is large ( Even all ) result , This is very similar to using cursors in traditional databases . ...

  9. stay linux How to decompress .tgz

    And then first : Open the terminal 1, Enter the download path , For example, mine is to enter Downloads Next . Enter the command : cd Downloads 2, Unzip to the current folder Input :tar zxvf  file name .tgz -C ./     ...

  10. centos6 and centos7 install git The difference between

    centos6 and centos7 install git The difference between centos6 install git yum install curl-devel expat-devel gettext-devel openssl-dev ...