You can download unarchiver from Apple store and use the unar command to use 7zip or use homebrew as follows. I am assuming you have homebrew installed.

$ brew update
$ brew install p7zip

These command update brew and install p7zip. To zip a file

$ 7z a myfile.7z mydirectory

To unzip

$ 7z x myfile.7z