What are you ultimately going to do with the file? That might determine what/how to do this.
If I recall correctly, the encryption used within the zip command is weak. And zip encryption, when available, is not always cross platform friendly.
But, yes, can encrypt a zip file via command line.
If already have a zip file, can run following command:
Code:
openssl enc -aes-256-cbc -a -in Archive.zip -out Archive.zip.enc
Can create a zip file with encryption:
Code:
zip -e myzip.zip file1 file2 file3 directory1 file4
And can also use the zipcloak command to encrypt a zip file:
Personally, I use the 7z format for encryption as it's open source, portable, create/read programs for all platforms. On Mac, I use the Keka program. It's in the App Store, but now costs $2.99 (I got it when still free).
If just staying on your Mac, can create an encrypted sparse image DMG file (via Disk Utility) and place your files into it.
But if looking to share the zip with someone else, or put on some different environment, might not be able to read it on other machine.