Install problem

Greetings!
I am new to Homebrew. I have a problem with installing Homebrew on MacOS 10.14.6 Mojave.
After I entered password, installation ended with the following error message.

Press RETURN to continue or any other key to abort

==> /usr/bin/sudo /bin/mkdir -p /usr/local/bin

Password:

mkdir: /usr/local/bin: Not a directory

Failed during: /usr/bin/sudo /bin/mkdir -p /usr/local/bin

osanghuns-MacBook-Pro:~ sanghun$

What is the output of:

ls -ld /usr/local/bin

?

Hi,

The output of the command is like this:

-rwxrwxr-x 1 sanghun admin 27415060 Jan 15 14:38 /usr/local/bin

Sang-Hun

That’s an executable file called /usr/local/bin, when it should be a directory:

$ ls -ld /usr/local/bin
drwxr-xr-x 855 gromgit admin 27360 Feb 16 11:48 /usr/local/bin/

Note the d at the start of the listing.

You want to rm -f /usr/local/bin and go through the Homebrew installation process again.

Hi,

Thanks for the help. I could not remove the bin file at Terminal. The error says that Permission denied. So I deleted in Finder. It worked until the Homebrew was downloaded. It looks like the same problem that I don’t have permission. The error message is following. How do I change the permission?

==> Downloading and installing Homebrew…

/usr/local/Homebrew/.git: Permission denied

Failed during: git init -q

Thanks!

Sang-Hun

What does:

ls -la /usr/local

output?

Hi,

The output is like this:

osanghuns-MacBook-Pro:~ sanghun$ ls -la /usr/local

total 0

drwxr-xr-x 15 root wheel 480 Feb 19 09:29 .

drwxr-xr-x@ 9 root wheel 288 Sep 21 2018 …

-rw-r–r-- 1 root wheel 0 Dec 22 03:17 .com.apple.installer.keep

drwxr-xr-x 2 root wheel 64 Feb 18 16:00 Caskroom

drwxr-xr-x 2 root wheel 64 Feb 18 16:00 Cellar

drwxrwxr-x 2 sanghun admin 64 Feb 18 16:00 Frameworks

drwxr-xr-x 2 root wheel 64 Feb 18 16:00 Homebrew

drwxrwxr-x 2 sanghun admin 64 Feb 19 09:29 bin

drwxrwxr-x 2 sanghun admin 64 Feb 18 16:00 etc

drwxrwxr-x 2 sanghun admin 64 Feb 18 16:00 include

drwxrwxr-x 2 sanghun admin 64 Feb 18 16:00 lib

drwxrwxr-x 2 sanghun admin 64 Feb 18 16:00 opt

drwxrwxr-x 2 sanghun admin 64 Feb 18 16:00 sbin

drwxrwxr-x 4 sanghun admin 128 Feb 19 08:45 share

drwxrwxr-x 3 sanghun admin 96 Feb 18 16:00 var

osanghuns-MacBook-Pro:~ sanghun$

Looks like you tried to install Homebrew as root, which is a strict no-no. Probably best to uninstall it as root:

sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

then install it again without root:

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

Hi,

I copied the first line and it came out the error message like this:

Failed to locate Homebrew!

Sang-Hun

In that case, you’ll have to delete the offending directories manually:

cd /usr/local
sudo rm -fr Caskroom Cellar Homebrew

Then reinstall Homebrew as in my previous message.

Hi,

Thanks for your help. It seems to work, downloading and installing files. But it has another error. Could you help? Sang-Hun

==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3.mavericks.bottle.tar.gz

######################################################################## 100.0%

==> Pouring portable-ruby-2.6.3.mavericks.bottle.tar.gz

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:

https://github.com/Homebrew/brew#donations

==> Tapping homebrew/core

Cloning into ‘/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core’…

remote: Enumerating objects: 6, done.

remote: Counting objects: 100% (6/6), done.

remote: Compressing objects: 100% (6/6), done.

remote: Total 682046 (delta 2), reused 2 (delta 0), pack-reused 682040

Receiving objects: 100% (682046/682046), 276.17 MiB | 3.59 MiB/s, done.

Resolving deltas: 100% (446828/446828), done.

Checking out files: 100% (5147/5147), done.

Tapped 4914 formulae (5,171 files, 302.9MB).

Already up-to-date.

Error: Failed to link all completions, docs and manpages:

Permission denied @ rb_file_s_symlink - (…/…/…/Homebrew/completions/zsh/_brew, /usr/local/share/zsh/site-functions/_brew)

Failed during: /usr/local/bin/brew update --force

osanghuns-MacBook-Pro:local sanghun$

Try doing sudo chown -R $(whoami) /usr/local/* and then running the installer again.

1 Like

Hi,

It worked. Thanks for your help! S-

Hi @SMillerDev, just want to let you know that I was experiencing the same problem with @sanghun253 and the solution you provided worked for me as well. Thanks!

1 Like