1

I am running this command: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

and I'm get hte error:

HEAD is now at 79e8cdd Merge pull request #1253 from jawshooah/perf/relocate-text-files
/usr/local/bin/brew: /usr/local/bin/readlink: /bin/bash: bad interpreter: Operation not permitted
/usr/local/bin/brew: /usr/local/bin/readlink: /bin/bash: bad interpreter: Operation not permitted
/usr/local/bin/brew: line 47: /usr/local/Library/Homebrew/brew.sh: No such file or directory
Failed during: /usr/local/bin/brew update --force

Does any one know how to solve this?

mumuhou
  • 15
  • 5
  • You'd better find and post the exact code that's giving the error. Otherwise, you'll have better luck in another forum. – piojo Oct 25 '16 at 07:55

2 Answers2

0

It's maybe related to filesystem metadata (quarantine attribute), run:

ls -l /usr/local/bin

If you see a @ character on some lines such as in -rwxr-xr-x@, you can remove the filesystem metadata with :

xattr -d com.apple.quarantine /usr/local/bin/readlink

Read this question for more information : Mac OS: /usr/bin/env: bad interpreter: Operation not permitted

Community
  • 1
  • 1
Ortomala Lokni
  • 56,620
  • 24
  • 188
  • 240
0

Just because I came across this answer in my search for how to fix this problem, and the accepted answer didn't work for me, I figured I would post my solution. After reinstalling brew a million different ways (which had issues due to the readlink problem), reinstalling ruby, xcode-tools, and every other piece of software on the planet, I had the "duhh" moment of trying to see what was wrong with readlink itself.

In the end, this is how I fixed it:

  1. cd /usr/local/bin
  2. rm readlink
  3. Make a file called realpath (or whatever you want) with this content

here:

#!/usr/bin/env python
import os,sys
print os.path.realpath(sys.argv[1])
  1. chmod +x realpath
  2. ln -s realpath readlink

The above instructions can be found here. Essentially we're just replacing whatever readlink they had implemented originally with Python's implementation of the functionality, their os.path.realpath function.

Daniel Porteous
  • 5,536
  • 3
  • 25
  • 44