Yesterday I reformatted my computer as it was starting to slow down. RAM and CPU usage was consistently higher than normal. Things just felt sluggish.
When I do a reformat like this, I ensure it is clean. This means that I only copy irreplaceable items from my backup, such as documents and pictures, but all of my applications I re-download and install from either the Mac App Store or their respective websites.
One key application I have been using a lot lately is MacVim. While useful on its own, it also comes with a BASH script for opening files in MacVim from the command line, called mvim.
As usual, I moved mvim to the bin directory in my home folder and ran it to see if it worked, only to receive the following error:
-bash: /Users/colincwilliams/bin/mvim: /bin/sh: bad interpreter: Operation not permitted
This was surprising as, on my previous install, mvim worked just fine from the get-go.
After some searching I noticed similar errors people had from other scripts. One of the common causes was incorrect line endings for the system: Windows is different than Mac OS is different than Unix. I won’t delve into the differences here, but you can read more about them in the Common Problems section of the Wikipedia Article.
To do this, open mvim in TextWrangler and in the menus select Text > Normalize Line Endings. Save the file and try executing mvim again. It should work just fine this time, opening a document in MacVim as expected.
A great text editor to always have on hand. ↩︎