Randomness for you since 1976
I wanted an easy way to encrypt and decrypt files in OS X from the command line, so I added the following to my .profile file in my home directory:
Now I can quickly encrypt a file using ‘enc’:
And decrypt it just as easily with ‘dec’:
A couple of things to note. The encrypted file is saved using a _enc suffix, but when decrypting, it assumes you type the original filename, not the _enc version. I don’t mind this, but it could be altered to be a little smarter in this regard. Also, when encrypting it deletes the original file for you, and when decrypting it deletes the encrypted version. I prefer this automatic ‘cleanup’.
This blog is a dumping grounds for my experiences as a web developer, a parent, an artist, a writer and a human being. Maybe someday there will be something here that is worth your time, some sort of useful information or words that piece your very soul. Probably not though.
Jason
January 31st, 2012 at 5:52 pm
I got a MacBook for Christmas and one of the things I’ve missed from the Linux world was the ability to encrypt files from the command line. Your suggestion here has made that easy again; thank you for that.