After successfully installed Ruby, now we need to type sudo gem install cucumber selenium-webdriver in "Terminal" to install Cucumber and Selenium-WebDriver.
sudo gem install cucumber selenium-webdriver
After install, you can run command cucumber --help to check.
cucumber --help