« Customizing Wireshark's UI Font on OS X | Main | 8 Ways to Improve Your Java EE Support Skills »


Bad Interpreter Errors Executing Scripts in OS X

Apparently, this is a well-documented issue people experience in OS X, (I, personally, do not recall experiencing it with third-party shell scripts prior to my 10.7.4 install but that could just be coincidental since I do not build from source all that often). Download a source archive from the Internet somewhere, then execute 'configure' to start building it, and you get the following error:

-bash: ./configure: /bin/sh: bad interpreter: Operation not permitted

For those familiar with the warning regarding opening files downloaded from the Internet when launching them with a mouse click, the error message above is that equivalent when executing something from the command line. The OS X extended attribute com.apple.quarantine is applied to executable files, which needs to be removed in order to run them. To fix, execute the following command in the terminal window (only after being certain that the files you want to strip the com.apple.quarantine extended attribute from are from trusted sources):

xattr -rd com.apple.quarantine /directory/path/to/files

If you run ls -l in those source directories prior to stripping out the extended attribute, you'll see permissions similar to the following set on executables and subdirectories within that directory:

-rwxr-xr-x@   1 uid  gid  315293 Nov  5  2011 configure*

After running the xattr command, permissions look like this (note the missing @ symbol):

-rwxr-xr-x    1 uid  gid  315293 Nov  5  2011 configure*


TrackBack URL for this entry:

Listed below are links to weblogs that reference Bad Interpreter Errors Executing Scripts in OS X: