galfenol

Q: bad interpreter: Operation not permitted on Lion 10.7.3

My unix scripts are now dead, after the upgrade to 10.7.3. A typical error message is   /bin/bash: bad interpreter: Operation not permitted  Googling this issue shows other people are having build scripts fail and are fixing this by renaming links to libraries.  My scripts are simple, they just run an executable, or used to...  something like this:

#! /bin/bash

./myprogram << EOF

$1

EOF

MacPlus, SE30, iMacG3, EmacG4, PB G4, iMacG5, PowerMacG5, iMac Intel, Mac OS X (10.7.2)

Posted on Feb 13, 2012 4:00 PM

Close

Q: bad interpreter: Operation not permitted on Lion 10.7.3

  • All replies
  • Helpful answers

Page 1 of 5 last Next
  • by etresoft,

    etresoft etresoft Feb 13, 2012 4:07 PM in response to galfenol
    Level 7 (29,056 points)
    Feb 13, 2012 4:07 PM in response to galfenol

    Where is "."? Have you installed programs into /usr or /bin somewhere? If so, they are gone. /usr/local would be a better place for them.

  • by Linc Davis,

    Linc Davis Linc Davis Feb 13, 2012 5:22 PM in response to galfenol
    Level 10 (207,926 points)
    Applications
    Feb 13, 2012 5:22 PM in response to galfenol

    The interpreter is the thing that comes after "#!"; in your case, /bin/bash. Are you able to open a shell in Terminal? If so, what is your shell, and what do you get from

     

    ls -Oel /bin/bash
    

     

    and

     

    codesign -vv /bin/bash
    
  • by galfenol,

    galfenol galfenol Feb 13, 2012 5:42 PM in response to etresoft
    Level 1 (0 points)
    Feb 13, 2012 5:42 PM in response to etresoft

    The ./myprogram means run the executable in the current working directory. This is not a problem with my bash scripts gone missing. They are right there in front of me. They just don't run any more.

  • by galfenol,

    galfenol galfenol Feb 13, 2012 5:52 PM in response to Linc Davis
    Level 1 (0 points)
    Feb 13, 2012 5:52 PM in response to Linc Davis

    Yes. My default shell is bash at the moment.

     

    ls -Oel /bin/bash 

    -r-xr-xr-x  1 root  wheel  compressed 1371648 Jul 11  2011 /bin/bash

     

    codesign -vv /bin/bash

    /bin/bash: satisfies its Designated Requirement

  • by Linc Davis,

    Linc Davis Linc Davis Feb 13, 2012 6:00 PM in response to galfenol
    Level 10 (207,926 points)
    Applications
    Feb 13, 2012 6:00 PM in response to galfenol

    What do you get from "ls -@Oel" on one of the problem scripts?

  • by galfenol,

    galfenol galfenol Feb 13, 2012 6:08 PM in response to Linc Davis
    Level 1 (0 points)
    Feb 13, 2012 6:08 PM in response to Linc Davis

    Something like this, where the shell script is fistofdeath.sh.

    The script has been made executable with chmod +x, or at least this used to work.

     

     

    bash-3.2$ ls -@Oel ./fistofdeath.sh

    -rwxr-xr-x@ 1 galfenol  staff  - 37 Feb 12 10:37 ./fistofdeath.sh

              com.apple.FinderInfo          32

              com.apple.ResourceFork          63127

              com.apple.TextEncoding          15

              com.apple.quarantine          23

    bash-3.2$

  • by etresoft,

    etresoft etresoft Feb 13, 2012 6:16 PM in response to galfenol
    Level 7 (29,056 points)
    Feb 13, 2012 6:16 PM in response to galfenol

    Yes, but the current working directory is highly context-dependent. Are you able to execute a script that just calls "env" or "echo"?

     

    Maybe remove that space before /bin/bash and see if that helps.

  • by Linc Davis,

    Linc Davis Linc Davis Feb 13, 2012 6:31 PM in response to galfenol
    Level 10 (207,926 points)
    Applications
    Feb 13, 2012 6:31 PM in response to galfenol

    Remove the quarantine attribute from your files as follows:

     

    find ~ -exec xattr -d com.apple.quarantine {} 2> /dev/null \;
    
  • by galfenol,

    galfenol galfenol Feb 13, 2012 6:48 PM in response to etresoft
    Level 1 (0 points)
    Feb 13, 2012 6:48 PM in response to etresoft

    The space makes no difference. I have no luck with a script like this, which I just wrote.

     

    bash-3.2$ more hello.sh

     

    #!/bin/bash         

    echo Hello World 

     

     

    bash-3.2$ ./hello.sh

    bash: ./hello.sh: /bin/bash: bad interpreter: Operation not permitted

  • by galfenol,

    galfenol galfenol Feb 13, 2012 7:05 PM in response to Linc Davis
    Level 1 (0 points)
    Feb 13, 2012 7:05 PM in response to Linc Davis

    How long should this command run for? Its taking a looong time.

    But your advice suggests using disk utility to check permissions.

    I will do that next, it the find command ever finishes.

  • by Linc Davis,

    Linc Davis Linc Davis Feb 13, 2012 7:11 PM in response to galfenol
    Level 10 (207,926 points)
    Applications
    Feb 13, 2012 7:11 PM in response to galfenol

    Depends on how many files you have. It might take hours.

     

    If clearing the quarantine attributes doesn't help, then repairing permissions would be a reasonable thing to try, though I doubt it will do any good. More likely, you'll need to reinstall the OS.

  • by BobHarris,

    BobHarris BobHarris Feb 13, 2012 7:23 PM in response to galfenol
    Level 6 (19,272 points)
    Mac OS X
    Feb 13, 2012 7:23 PM in response to galfenol

    I think Linc is on the right track, but just in case, what is the contents of your /etc/shells file?  Mine looks like the following:

     

    # List of acceptable shells for chpass(1).
    # Ftpd will not allow users to connect who are not using
    # one of these shells.
    
    
    /bin/bash
    /bin/csh
    /bin/ksh
    /bin/sh
    /bin/tcsh
    /bin/zsh
    
  • by galfenol,

    galfenol galfenol Feb 13, 2012 7:28 PM in response to Linc Davis
    Level 1 (0 points)
    Feb 13, 2012 7:28 PM in response to Linc Davis

    I have 2 machines, both iMac i7, that exhibit this problem after installing 10.7.3.

  • by galfenol,

    galfenol galfenol Feb 13, 2012 7:29 PM in response to BobHarris
    Level 1 (0 points)
    Feb 13, 2012 7:29 PM in response to BobHarris

    bash-3.2$ more shells

    # List of acceptable shells for chpass(1).

    # Ftpd will not allow users to connect who are not using

    # one of these shells.

     

     

    /bin/bash

    /bin/csh

    /bin/ksh

    /bin/sh

    /bin/tcsh

    /bin/zsh

Page 1 of 5 last Next