Operation Not Permitted during install


(Steveharman) #1

I’m getting an error when performing a new Homewbrew install on to my MBPro (10.11.6 SIP disabled):

    ~ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    ==> This script will install:
    /usr/local/bin/brew
    /usr/local/share/doc/homebrew
    /usr/local/share/man/man1/brew.1
    /usr/local/share/zsh/site-functions/_brew
    /usr/local/etc/bash_completion.d/brew
    /usr/local/Homebrew

    Press RETURN to continue or any other key to abort
    ==> Downloading and installing Homebrew...
    remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
    HEAD is now at 9cce341 Merge pull request #1806 from MikeMcQuaid/audit-virtualenv-setuptools
    ln: /usr/local/bin/brew: Operation not permitted
    Failed during: ln -sf /usr/local/Homebrew/bin/brew /usr/local/bin/brew

This feels like a permissions issue but I’m lost as to precisely what. Relevant things about my /usr/local/Homebrew:

drwxrwxr-x 17 steveharman admin 578B 9 Jan 15:22 Homebrew
-rwxr-xr-x 1 steveharman admin 1.3K 9 Jan 15:22 brew

My usr/local/bin:

drwxrwxr-x 2 steveharman admin 68B 9 Jan 15:22 bin

Any help would be much appreciated.

Thanks,

Steve


(Mike McQuaid) #2

Please don’t disable SIP, it’s. a security feature we rely on.

sudo chown -R $USER /usr/local and try to reinstall.


(Steveharman) #3

Hi Mike,

Thanks for the reply. I got the idea about disabling SIP from somewhere on StackOver, I think. Anyway I’ll switch it back on per your suggestion.

Pretty sure I already tried chown’ing /usr/local but I did it again anyway. Sadly it’s the same issue:

Last login: Thu Jan 12 08:20:06 on console
➜  ~ sudo chown -R $USER /usr/local
Password:
➜  ~ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following existing directories will be made group writable:
/usr/local/lib/pkgconfig
/usr/local/share/man
/usr/local/share/man/man8
==> The following existing directories will have their owner set to steveharman:
/usr/local/lib/pkgconfig
/usr/local/share/man
/usr/local/share/man/man8

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/lib/pkgconfig /usr/local/share/man /usr/local/share/man/man8
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/lib/pkgconfig /usr/local/share/man /usr/local/share/man/man8
==> /usr/bin/sudo /usr/sbin/chown steveharman /usr/local/lib/pkgconfig /usr/local/share/man /usr/local/share/man/man8
==> Downloading and installing Homebrew...
remote: Counting objects: 19, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 19 (delta 16), reused 14 (delta 11), pack-reused 0
Unpacking objects: 100% (19/19), done.
From https://github.com/Homebrew/brew
 + 9cce341...ebf3d93 master     -> origin/master  (forced update)
 * [new tag]         1.1.7      -> 1.1.7
HEAD is now at ebf3d93 Merge pull request #1808 from MikeMcQuaid/deprecate-linkapps
ln: /usr/local/bin/brew: Operation not permitted
Failed during: ln -sf /usr/local/Homebrew/bin/brew /usr/local/bin/brew
➜  ~

Cheers,

Steve


(Mike McQuaid) #4

Try once more after also doing sudo rm -rf /usr/local/bin/brew, thanks!


(Steveharman) #5

Exactly the same error I’m afraid Mike, although thanks for the suggestion.

~ sudo rm -rf /usr/local/bin/brew
Password:


~ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 5), reused 3 (delta 2), pack-reused 0
Unpacking objects: 100% (6/6), done.
From https://github.com/Homebrew/brew
 + ebf3d93...b344759 master     -> origin/master  (forced update)
HEAD is now at b344759 Merge pull request #1707 from apjanke/deps-tree-fix-broken-line
ln: /usr/local/bin/brew: Operation not permitted
Failed during: ln -sf /usr/local/Homebrew/bin/brew /usr/local/bin/brew

(Mike McQuaid) #6

What does ls -lha /usr/local/bin output?


(Steveharman) #7

Looks like this Mike:

ls -lha /usr/local/bin
total 56
drwxrwxr-x     9 steveharman  admin   306B 10 Jan 11:06 .
drwxrwxr-x  1065 root         staff    35K 11 Jan 13:18 ..
lrwxr-xr-x     1 root         admin    68B 10 Jan 11:06 prl_convert -> /Applications/Parallels Desktop.app/Contents/MacOS/parallels_wrapper
lrwxr-xr-x     1 root         admin    68B 10 Jan 11:06 prl_disk_tool -> /Applications/Parallels Desktop.app/Contents/MacOS/parallels_wrapper
lrwxr-xr-x     1 root         admin    68B 10 Jan 11:06 prl_perf_ctl -> /Applications/Parallels Desktop.app/Contents/MacOS/parallels_wrapper
lrwxr-xr-x     1 root         admin    62B 10 Jan 11:06 prlcore2dmp -> /Applications/Parallels Desktop.app/Contents/MacOS/prlcore2dmp
lrwxr-xr-x     1 root         admin    68B 10 Jan 11:06 prlctl -> /Applications/Parallels Desktop.app/Contents/MacOS/parallels_wrapper
lrwxr-xr-x     1 root         admin    58B 10 Jan 11:06 prlexec -> /Applications/Parallels Desktop.app/Contents/MacOS/prlexec
lrwxr-xr-x     1 root         admin    68B 10 Jan 11:06 prlsrvctl -> /Applications/Parallels Desktop.app/Contents/MacOS/parallels_wrapper

(Mike McQuaid) #8

I’d advise doing sudo rm -rf /usr/local/bin and trying again.


(Steveharman) #9

Sadly, same-old, same-old… :frowning:

==> /usr/bin/sudo /bin/mkdir -p /usr/local/bin
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/bin
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown steveharman /usr/local/bin
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/bin
==> Downloading and installing Homebrew...
remote: Counting objects: 47, done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 47 (delta 42), reused 27 (delta 22), pack-reused 0
Unpacking objects: 100% (47/47), done.
From https://github.com/Homebrew/brew
 + b344759...f024964 master     -> origin/master  (forced update)
HEAD is now at f024964 formula_installer: use attr_accessor for installed_*
**ln: /usr/local/bin/brew: Operation not permitted**
Failed during: ln -sf /usr/local/Homebrew/bin/brew /usr/local/bin/brew 

/usr/local/bin is empty:

bin ls -alh
total 0
drwxrwxr-x     2 steveharman  admin    68B 19 Jan 11:42 .
drwxrwxr-x  1065 root         staff    35K 19 Jan 11:42 ..
➜  bin

(Mike McQuaid) #10

Try sudo chown -R $USER /usr/local and again.


(Steveharman) #11

Thanks for your efforts Mike, but I give up. It’s exactly the same error with everything we’ve tried.

Regards,

Steve

==> Downloading and installing Homebrew...
remote: Counting objects: 62, done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 62 (delta 53), reused 49 (delta 40), pack-reused 0
Unpacking objects: 100% (62/62), done.
From https://github.com/Homebrew/brew
 + f024964...c9d7bab master     -> origin/master  (forced update)
HEAD is now at c9d7bab Merge pull request #1889 from alyssais/clear_tab_cache_in_teardown
ln: /usr/local/bin/brew: Operation not permitted
Failed during: ln -sf /usr/local/Homebrew/bin/brew /usr/local/bin/brew
➜  ~

(Mike McQuaid) #12

Sorry, I don’t know what’s wrong with your system :frowning:


(Steveharman) #14

It’s a fresh install of El Capitain so I’m lost too. As is @alexdnaz by the looks of it.

Thanks for your efforts though Mike,

Steve