Installing Ruby and Beef on MAC

Ahmedulde
3 min readJan 17, 2023

--

There are a few challenges that can arise when installing Ruby on a Mac, such as:

  1. Conflicting versions: If you already have Ruby installed on your system, trying to install a new version can cause conflicts and errors. This can be resolved by using a version manager such as rbenv or rvm, which allows you to easily switch between different versions of Ruby.
  2. Dependency issues: Ruby has a number of dependencies, such as OpenSSL, libyaml, and readline. If these dependencies are not met or are not compatible with the version of Ruby you are trying to install, you may encounter errors during the installation process.
  3. Permissions issues: If you are installing Ruby as a non-root user, you may encounter errors related to permissions when trying to install or upgrade Ruby. This can be resolved by using a package manager like Homebrew, which manages dependencies and permissions for you.
  4. Compatibility issues: It’s also important to check that the version of Ruby you are installing is compatible with the version of the operating system you are running. For example, if you are running an older version of macOS, you may need to install an older version of Ruby that is compatible with your system.
  5. Old version of XCode: If you are running an old version of XCode, it may not be able to build some of the native extensions required for certain gems. Updating to the latest version of XCode should resolve this issue.

Installing Ruby on a Mac can be done in a few simple steps.

  1. First, check if Ruby is already installed on your system by opening a terminal window and typing “ruby -v”. This command will display the version of Ruby currently installed on your system. If Ruby is not installed, or if you want to install a different version, you can proceed to the next step.
  2. The easiest way to install Ruby on a Mac is to use the package manager Homebrew. If you don’t have Homebrew installed, you can install it by opening a terminal window and typing “ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"" or you can also visit homebrew link
  3. Once Homebrew is installed, you can use it to install Ruby by typing “brew install ruby” in the terminal window. This will download and install the latest version of Ruby.
  4. To verify that Ruby has been installed successfully, you can type “ruby -v” again in the terminal window. This should display the version of Ruby that you just installed.

By following these steps, you should have Ruby installed on your Mac and be ready to start developing with it.

ruby -v
brew install ruby
echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
echo 'export LDFLAGS="-L/opt/homebrew/opt/ruby/lib"' >> ~/.zshrc
echo 'export CPPFLAGS="-I/opt/homebrew/opt/ruby/include"' >> ~/.zshrc
source ~/.zshrc

# the steps below are necessary for beef installation.
# eventmachine is of the gems needed for beef
brew link --force openssl@1.1
gem install eventmachine
gem install eventmachine -- --with-openssl-dir=/opt/homebrew/opt/openssl@1.1

Once you have ruby installed, then you can proceed further to install beef.

BeEF (Browser Exploitation Framework) is a penetration testing tool that focuses on the web browser. Here are the steps to install BeEF on a Mac using the Git source:

  1. First, make sure that you have Git installed on your system. You can check if Git is installed by running the command “git — version” in a terminal window. If Git is not installed, you can install it using Homebrew by running the command “brew install git”.
  2. Next, clone the BeEF repository from GitHub by running the following command in a terminal window: “git clone https://github.com/beefproject/beef.git"
  3. Change directory to the beef folder: “cd beef”
  4. Run the installer: “./install”
  5. Start the BeEF server: “./beef”
  6. Open your browser and go to “http://localhost:3000/ui/panel" to access the BeEF web interface.
  7. To stop the BeEF server, you can use command: “./beef -x”

Please note that BeEF is a powerful tool that should only be used in a controlled environment and with proper consent. It should not be used for any illegal activities.

Also please note that some dependencies like ruby, gems etc are needed to be installed prior to running the above command, as you can see in the first step.

--

--

Ahmedulde
Ahmedulde

Written by Ahmedulde

Trusted Advisor, Mentor — Cloud and Devops SME

No responses yet