Nik_stack
Nik_stack

Reputation: 213

Unable to install Python3 via Homebrew

I want to install python 3 via Homebrew. Here is the error I get:

Error: You must `brew link xz gdbm' before python3 can be installed

Now when I do 'brew link xz gdbm' I get this:

Linking /usr/local/Cellar/gdbm/1.11... Error: Could not symlink include/gdbm.h/usr/local/include is not writable.

I tried the following options to fix this:

sudo chown -R $USER /usr/local/bin/include
usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group] file ...
   chown [-fhv] [-R [-H | -L | -P]] :group file ...

After this I tried to install python3 again but I am getting the same error. Please help.

Upvotes: 0

Views: 3106

Answers (3)

laftworld
laftworld

Reputation: 1

run

    brew doctor

then you'll see a diagnosis like this:

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run brew link on these:

  makedepend

it means you can fix by running this code:

 brew link makedepand

so now this works.

 brew install pyenv

Upvotes: 0

apadana
apadana

Reputation: 14690

I had the same problems. Run

brew doctor

(probably you also need to update brew if it's old with command brew update) and after warnings are cleared python installation should move forward without a hitch.

Please note you can run brew doctor as many times until all warnings are gone.

Upvotes: 0

ianml
ianml

Reputation: 782

/usr/local/include is not writable.

sudo chown -R $USER /usr/local/bin/include

The directory you want to chown is /usr/local/include, or /usr/local proper.

Upvotes: 3

Related Questions