1

I recently replaced adoptopenjdk-13 with adoptopenjdk-16. I have a script file that uses the tool by name, so I changed it from 13 to 16. Its new contents:

#!/bin/bash
if [ -z ${JAVA_OPTS+x} ]
then
  # Set some defaults
  JAVA_OPTS=""
fi
/Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home/bin/java $JAVA_OPTS -jar $CROMWELL_HOME/womtool.jar "$@"

me $  which bash
/bin/bash
me $  ll /usr/local/cromwell
total 16
drwxr-xr-x   6 root  wheel   192B Sep 27 12:43 ./
drwxr-xr-x  23 root  wheel   736B Nov 10  2020 ../
-rwxr-xr-x@  1 root  wheel   210B Sep 27 12:42 cromwell*
lrwxr-xr-x   1 root  wheel    39B Jul 14 15:14 cromwell.jar
-rwxr-xr-x@  1 root  wheel   208B Sep 27 12:41 womtool*
lrwxr-xr-x   1 root  wheel    38B Jul 14 15:14 womtool.jar
m082166@me $ $CROMWELL_HOME/womtool validate MyWDL.wdl
-bash: /usr/local/cromwell/womtool: /bin/bash: bad interpreter: Operation not permitted
me $  /Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home/bin/java $JAVA_OPTS -jar $CROMWELL_HOME/womtool.jar validate MyWDL.wdl
Success!

Why is bash refusing to let me run the script, when running the contents of the script is perfectly fine? This literally just broke after I updated the script file to point to the correct tool

9
  • Does the user have execution permissions to the script?
    – eftshift0
    Sep 27, 2021 at 20:20
  • 1
    Also, another question. What is the EOL format of the script?
    – eftshift0
    Sep 27, 2021 at 20:22
  • 1
    Is it possible that you updated the script using Windows end-of-line terminators? Does head -1 /usr/local/cromwell/womtoll | od -c contain a \r character?
    – doneal24
    Sep 27, 2021 at 20:24
  • 2
    Perhaps, this is relevant: malcontentboffin.com/2019/12/…
    – eftshift0
    Sep 27, 2021 at 20:26
  • 1
    Thank you @eftshift0 that was it. Please make that an answer, so I can upvote and green check it :-) Sep 27, 2021 at 23:09

2 Answers 2

3

Thanks to elfshift This was the answer. Apparently the MacOS decided to put those files into "quarantine", and so wouldn't let me run the files

sudo xattr -d com.apple.quarantine /usr/local/cromwell/*

fixed the issue

1

To view the extended attributes of the file (my filename is script.sh):

xattr -l script.sh

If you see com.apple.quarantine in the list of attributes, remove it using this command:

xattr -d com.apple.quarantine my-file.sh

If you have multiple files, feel free to update the last parameter as it fits.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .