2

When I give the following command

brew install homebrew/science/opencv

or

brew install opencv 

I get the following message.

Warning: opencv-2.4.7.1 already installed, it's just not linked

Any idea how to fix this. I already have the following in the .bash_profile based on the links.

Installing openCV 2.4.2 on Mac OS X 10.9 (Mavericks)

export PYTHONPATH=/usr/local/Cellar/opencv/2.4.6.1/lib/python2.7/site-packages:$PYTHONPATH

Linking Python with Open CV on Mac

export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH 

When I do a link using the following command, I get the following error.

$brew link opencv
Linking /usr/local/Cellar/opencv/2.4.7.1... Warning: Could not link opencv. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/opencv/2.4.7.1/lib/pkgconfig/opencv.pc
/usr/local/lib/pkgconfig is not writable. You should change its permissions.

Any ideas how to fix this ?

Thanks.

Community
  • 1
  • 1
Soumya Simanta
  • 11,523
  • 24
  • 106
  • 161

4 Answers4

3

I solve this problem by use sudo chown -R $USER /usr/local/lib/python2.7/site-packages

then brew link numpy

2

I solved the problem with brew link --overwrite --dry-run opencv

hinojsa
  • 36
  • 3
  • 1
    I dont understand, I thought the dry run doesnt actually change anything. I tried it and like it displayed what the changes would be but the error is still there – the pickle Mar 13 '15 at 22:00
2

I've got the same problem. And by following the post mentioned above, I solve the problem through a series of chown command suggested by brew doctor. Here is what I got when I use brew doctor

Warning: Some directories in /usr/local/share/man aren't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to add locale information to one of these
directories, then the install will fail during the link step.
You should probably `chown` them:

    /usr/local/share/man/de
    /usr/local/share/man/de/man1
    /usr/local/share/man/mann

So I change the own of these folders.

After that I use brew link --overwrite opencv

Now when I type brew link opencv, it shows

Warning: Already linked: /usr/local/Cellar/opencv/2.4.11
To relink: brew unlink opencv && brew link opencv

I think it works.

Dylan
  • 1,315
  • 3
  • 12
  • 19
0

I run 'brew doctor' and then just followed the brew doctor instructions

Laura Vieira
  • 165
  • 1
  • 9