First install Octave on Mac:
sudo xcode-select --install
brew install octave
and to upgrade
brew update && brew upgrade octave
Then head over to the Octave Programming Tutorial and try a few things.
x = linspace(0, 2*pi, 100);
y = sin(x);
plot(x,y);
hold on;
plot(y,x);