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

11
  • 1
    Also, another question. What is the EOL format of the script? Commented 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? Commented Sep 27, 2021 at 20:24
  • 2
    Perhaps, this is relevant: malcontentboffin.com/2019/12/… Commented 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 :-) Commented Sep 27, 2021 at 23:09
  • 1
    @eftshift0 this is why answers, not links to answers, are preferred on SE sites. That link is dead. Commented Feb 28, 2024 at 22:40

2 Answers 2

5

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
  • 1
    Fixed it for me too. Strange, I use this script all the time, not sure how or why it got re-quarantined. Commented Feb 28, 2024 at 22:40
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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.