found some answers here that didn't help me so much

ohad@Macintosh-2:/Volumes/develpment/global_constants (master *+)$ node_modules/.bin/mocha -w
bash: node_modules/.bin/mocha: /bin/csh: bad interpreter: Operation not permitted

the file is

cat node_modules/.bin/mocha
#!/usr/bin/env node

 * This tiny wrapper file checks for known node flags and appends them

This happens not just here but every time I try to run a bash from my comp. I'm new to bash and not so familiar with linux, can somebody help?

Edit: I'm using Osx. I've tried

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

it's still running..

tried editing and removing all stuff from my .bash_profile

export PROMPT_COMMAND='echo -ne "\033]0;${PWD##*/}\007"'
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

# Textmate's ruby
export TM_RUBY=rvm-auto-ruby

export PATH="/usr/local/bin:/usr/local/sbin:/opt/local/bin/:/usr/local/mysql-5.1.58-osx10.6-x86_64/bin:$PATH"
export JAVA_HOME=/Library/Java/Home
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export LC_CTYPE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export GEM_EDITOR='mate'
export VBOX_IP=""

    bind 'set completion-ignore-case on'

    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
        . ~/.bashrc
    source ~/.git-completion.bash

    # User specific environment and startup programs
    function crc32 { cksum -o3 "$@"|ruby -e 'STDIN.each{|a|a=a.split;printf "%08X\t%s\n",a[0],a[2..-1].join(" ")}'; }

    #required to get X11 working right (for ssh -X and gtk)
    export DISPLAY=:0

    source ~/.git-completion.bash

    #modified (colourised) prompt
    #export PS1='\h:\w \e[31m\u\e[0m$'
    #export PS1='[\t] \h:\w \u\$ '

    #export PS1='\u@\h:\w \$ '

#   export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    export PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\$ '

    # ls aliases

# colors that "ls" uses.
    export CLICOLOR=1
    #export LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jpg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.png=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:"

    #export LS_COLORS='no=00:fi=00:di=01;34:ln=01;43;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32;41:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jpg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.png=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:'

    LS_COLORS=$LS_COLORS:'no=0'           # Normal text
    LS_COLORS=$LS_COLORS:'fi=0'           # Regular file
    LS_COLORS=$LS_COLORS:'di=36'          # Directory
    LS_COLORS=$LS_COLORS:'ln=01;36'       # Symbolic link
    LS_COLORS=$LS_COLORS:'pi=33'          # Named pipe
    LS_COLORS=$LS_COLORS:'so=01;35'       # Socket
    LS_COLORS=$LS_COLORS:'do=01;35'       # DO
    LS_COLORS=$LS_COLORS:'bd=01;37'       # Block device
    LS_COLORS=$LS_COLORS:'cd=01;37'       # Character device
    LS_COLORS=$LS_COLORS:'ex=35'          # Executable file
    LS_COLORS=$LS_COLORS:'*FAQ=31;7'      # FAQs
    LS_COLORS=$LS_COLORS:'*.sh=47;31'     # Shell-Scripts
    LS_COLORS=$LS_COLORS:'*.vim=35'       # Vim-"Scripts"
    LS_COLORS=$LS_COLORS:'*.swp=00;44;37' # Swapfiles (Vim)
    LS_COLORS=$LS_COLORS:'*.sl=30;33'     # Slang-Scripts
    LS_COLORS=$LS_COLORS:'*,v=5;34;93'    # Versioncontrols
    LS_COLORS=$LS_COLORS:'or=01;05;31'    # Orphaned link
    LS_COLORS=$LS_COLORS:'*.c=33'         # Sources
    LS_COLORS=$LS_COLORS:'*.C=33'         # Sources
    LS_COLORS=$LS_COLORS:'*.h=33'         # Sources
    LS_COLORS=$LS_COLORS:'*.cc=33'        # Sources
    LS_COLORS=$LS_COLORS:'*.py=33'        # Sources
    LS_COLORS=$LS_COLORS:'*.rb=33'        # Sources
    LS_COLORS=$LS_COLORS:'*.awk=33'       # Sources
    LS_COLORS=$LS_COLORS:'*.pl=33'        # Sources
    LS_COLORS=$LS_COLORS:'*.jpg=0;32'     # Images
    LS_COLORS=$LS_COLORS:'*.jpeg=0;32'    # Images
    LS_COLORS=$LS_COLORS:'*.JPG=0;32'     # Images
    LS_COLORS=$LS_COLORS:'*.gif=0;32'     # Images
    LS_COLORS=$LS_COLORS:'*.png=0;32'     # Images
    LS_COLORS=$LS_COLORS:'*.jpeg=0;32'    # Images
    LS_COLORS=$LS_COLORS:'*.ppm=0;32'     # Images
    LS_COLORS=$LS_COLORS:'*.pgm=0;32'     # Images
    LS_COLORS=$LS_COLORS:'*.pbm=0;32'     # Images
    LS_COLORS=$LS_COLORS:'*.tar=31'       # Archive
    LS_COLORS=$LS_COLORS:'*.tgz=31'       # Archive
    LS_COLORS=$LS_COLORS:'*.gz=31'        # Archive
    LS_COLORS=$LS_COLORS:'*.zip=31'       # Archive
    LS_COLORS=$LS_COLORS:'*.sit=31'       # Archive
    LS_COLORS=$LS_COLORS:'*.lha=31'       # Archive
    LS_COLORS=$LS_COLORS:'*.lzh=31'       # Archive
    LS_COLORS=$LS_COLORS:'*.rar=31'       # Archive
    LS_COLORS=$LS_COLORS:'*.arj=31'       # Archive
    LS_COLORS=$LS_COLORS:'*.bz2=31'       # Archive
    LS_COLORS=$LS_COLORS:'*.avi=35'       # Video
    LS_COLORS=$LS_COLORS:'*.mpg=35'       # Video
    LS_COLORS=$LS_COLORS:'*.mpeg=35'      # Video
    LS_COLORS=$LS_COLORS:'*.divx=35'      # Video
    LS_COLORS=$LS_COLORS:'*.xvid=35'      # Video
    LS_COLORS=$LS_COLORS:'*.mov=35'       # Video
    LS_COLORS=$LS_COLORS:'*.mp4=35'       # Video
    LS_COLORS=$LS_COLORS:'*.m4v=35'       # Video
    LS_COLORS=$LS_COLORS:'*.wmv=35'       # VIdeo
    LS_COLORS=$LS_COLORS:'*.mp3=37'       # Audio
    LS_COLORS=$LS_COLORS:'*.ogg=37'       # Audio
    LS_COLORS=$LS_COLORS:'*.wav=37'       # Audio
    LS_COLORS=$LS_COLORS:'*.au=37'        # Audio
    LS_COLORS=$LS_COLORS:'*.html=36'      # HTML
    LS_COLORS=$LS_COLORS:'*.htm=1;34'     # HTML
    LS_COLORS=$LS_COLORS:'*.php=1;45'     # PHP
    LS_COLORS=$LS_COLORS:'*.doc=1;34'     # MS-Word
    LS_COLORS=$LS_COLORS:'*.txt=1;34'     # Plain/Text
    LS_COLORS=$LS_COLORS:'*.o=1;36'       # Object-Files
    LS_COLORS=$LS_COLORS:'*.a=1;36'       # Shared-libs
    export LS_COLORS

export PATH=/opt/local/bin:/opt/local/sbin:$PATH
clean(){ #various commands to clean files that are weirdly changed.
  echo "running git checkout Gemfile.lock "
    git checkout Gemfile.lock
      echo "running rm dump.rdb "
        rm dump.rdb
      echo "Done cleaning"


    startup(){ #start up commands
      echo "redis"
        sudo redis-server
       echo "mongo"
         sudo mongod
      echo "rabbit"

if [ -f `brew --prefix`/etc/bash_completion ]; then
  . `brew --prefix`/etc/bash_completion

if [ -f ~/bash_completion.d/knife ]; then
  . ~/bash_completion.d/knife

[ -s "/Users/ohad/.nvm/nvm.sh" ] && . "/Users/ohad/.nvm/nvm.sh" # This loads nvm
  • Does /bin/csh exist? Does it have the right permissions? – choroba Apr 30 '14 at 15:49
  • 1
    Please clarify if you only mean Linux or OSX. Also, what answers did you find that didn't help you? Why didn't they help you? – Doktoro Reichard Apr 30 '14 at 15:51
  • Firstly, what is the result of which node. Second, does it work when you invoke node directly? – Elliott Frisch Apr 30 '14 at 20:34
  • @ElliottFrisch the result is which node /usr/local/bin/node. for your second question - yes it works. what does it mean? – WebQube Apr 30 '14 at 20:50

"Operation not permitted"

Sometimes "Opreation not permitted" means too that you're trying to open an executable file which isn't.

You can use sudo chmod +x yourfile

Did you tried as user root ? sudo yourcommand

For some reasons, when I use sudo, it doesn't always works.

So you can try sudo su.

If you're not in the sudoers file, just add you with su then visudo.

  • still doesn't work.. getting the same error – WebQube Apr 30 '14 at 16:25
  • i've edited my question to add tried outs – WebQube Apr 30 '14 at 16:26

I think you were on the right track with your xattr command. This question provides an explanation:

Did you happen to open/save the file in TextEdit?

That can introduce filesystem metadata (quarantine attribute) leading to the symptom you describe.

The command you ran:

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

Will only remove the quarantine attribute on files beneath your home directory (~). You should try:

xattr -d com.apple.quarantine /Volumes/develpment/global_constants/node_modules/.bin/mocha

And/or replace ~ in your original command with one of the parent directories of the script(s) you're having trouble running.

  • I'm trying but it takes forever.. – WebQube Apr 30 '14 at 20:33
  • 1
    I think there's a -r recursive option that you could combine with the -d, i.e. -dr. It might be quicker than using find/exec. – Lqueryvg Apr 30 '14 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.