Sorry, I'm somewhat new to this...I'm getting this error when trying to run a script. Other posts mentioning this error haven't been helpful. Here are some outputs that I've seen other posts mention:

uname -a
Linux aaron-850-065se 3.13.0-79-generic #123-Ubuntu SMP Fri Feb 19 14:27:58 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

file filename
Mach-O 64-bit x86_64 executable

Any ideas how I can get my file run?

  • 1
    What is the output of file filename. What is the content of the script? (Paste it, or at least the first few lines of it, into the post using the edit link. What are the permissions (ls -l filename). And last but not least, what is the precise error which you get?
    – Hennes
    Mar 8 '16 at 14:12
  • Does your script begin with #!/bin/bash or similar, so the OS knows it's a script? If not it may be trying to run it as a binary which will fail if it's not actually an executable-format binary.
    – LawrenceC
    Mar 8 '16 at 14:16
  • To expand on @Hennes' comment, you must have the read and executable bits set on the file and all the directories in its path (strictly, you don't need read on the directories, but you won't be able to browse or auto-complete without it). If it's a script you can run it without the executable bit by using the source or . command, but this isn't a work-round. The file command output is important: it will tell you the type of the file (if you can read it), but not whether you can execute it. The #! command processor definition is always helpful, but not essential.
    – AFH
    Mar 8 '16 at 14:45
  • 2
    Are you sure it's a script? Mach-o executable is the output for a binary executable file intended for Mac OS X.
    – Barmar
    Mar 8 '16 at 20:48
  • 1
    @barmar I do believe that might be an answer. And the question a cautionary tale on knowing what you are running.
    – Journeyman Geek
    Mar 9 '16 at 3:31

Mach-O 64-bit x86_64 executable is the binary executable file format used on OS X. If you downloaded this from somewhere, it seems like you downloaded the OS X version rather than the Linux version.

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.