Metasploit Framework

Rapid7 GitHub: Metasploit Framework

❗️ PostgreSQL and NMAP are required dependencies for Metasploit

Step 1: Clone metasploit-framework repository

mkdir metasploit-framework && cd metasploit-framework
git clone https://github.com/rapid7/metasploit-framework.git .

Step 2: Install bundler with gem

gem install bundler

Step 3: Configure bundle and install metasploit-framework

bundle config set --local path 'vendor/bundle'
bundle install

Step 4: Create an alias for metasploit-framework tools

Add the following lines to $HOME/.zshrc

📝 $HOME/opt is used as the example parent working directory. Use the working directory for your setup if different.

# Created for 'metasploit-framework'
  alias msfconsole="$HOME/opt/metasploit-framework/msfconsole"
  alias msfvenom="$HOME/opt/metasploit-framework/msfvenom"

Step 5: Patch msfvenom code

❗️ As of June 2025, msfvenom can’t be run outside of the metasploit-framework git repository due to an issue in the codebase.

Add the following lines to the START of metasploit-framework/msfvenom

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile', __dir__)
require 'bundler/setup'

📝 This patches msfvenom to load gems correctly when run.

Step 6: Verify msfvenom patch

msfvenom -h
../