Run JavaScript on Mac OS X with Rhino
1) Open Terminal and install HomeBrew with the following command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
2) Enter the following and install Rhino using Homebrew
brew install rhino
3) Navigate to the location of your JavaScript File in Terminal
cd foldername
4) Enter the following
rhino programName.js