The Case of the 500-Mile Email

I came across the story of the 500-Mile Email quite some time ago, but it’s an absolute classic:

I was working in a job running the campus email system some years ago when I got a call from the chairman of the statistics department.

“We’re having a problem sending email out of the department.”

“What’s the problem?” I asked.

“We can’t send mail more than 500 miles,” the chairman explained.

I choked on my latte. “Come again?”

“We can’t send mail farther than 500 miles from here,” he repeated. “A little bit more, actually. Call it 520 miles. But no farther.”

mvim Bash Error — bad interpreter: Operation not permitted

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.

On OS X, the simplest fix for this that I could think of was using Bare Bones Software’s TextWrangler1.

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.

  1. A great text editor to always have on hand. ↩︎

Consistently Connect iPhone to Mac Over Bluetooth

For the past few months I’ve been using an application called Type2Phone which allows me to use my Macbook keyboard to type on my iPhone. It works very well, using bluetooth for the connection and makes sending texts and instant messages (MSN, GoogleTalk) far faster on the iPhone. Type2Phone has been the first and only reason I’ve ever had to connect my iPhone to my Macbook over Bluetooth.

Since I started using it, however, I had major issues with connecting my phone to my laptop over bluetooth (note that this is an issue with iOS and/or OS X, not with Type2Phone). Once the devices were paired, trying to connect them would often result in errors such as:

  • “Macbook not within range.”
  • “Macbook is not a supported device."1

Finally, after far too much frustration, I believe I know how to connect my iPhone and Macbook consistently and it’s quite simple:

Have Type2Phone2 running when you try to connect the devices.

That’s it.

Since I’ve started doing this I haven’t seen any errors and using Type2Phone has become a far more enjoyable experience.

  1. This resulted in a single option to clear the message: Forget Device. Now the pairing was lost and I had to start from scratch. ↩︎

  2. Presumably this fix would work with any program that is actively trying to use Bluetooth open, however I am unable to test that hypothesis as I have no other apps on my computer that utilize bluetooth. ↩︎