Is it safe to overwrite /usr/local/bin/convert on OS X? - macos

I am trying to install imagemagick on OS X Mavericks. When I run brew install imagemagick I get this output at the end:
Warning: Could not link imagemagick. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link imagemagick'
Possible conflicting files are:
/usr/local/bin/convert
/usr/local/share/man/man1/convert.1
==> Summary
I tried some of the solutions listed here (not all though), but didn't get further. I also tried brew link imagemagick, but I get:
Linking /usr/local/Cellar/imagemagick/6.8.7-7... Warning: Could not link imagemagick. Unlinking...
Error: Could not symlink file: /usr/local/Cellar/imagemagick/6.8.7-7/bin/convert
Target /usr/local/bin/convert already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
brew link --overwrite formula_name
To list all files that would be deleted:
brew link --overwrite --dry-run formula_name
So my question: is it safe to run brew link --overwrite imagemagick? What could go wrong if I overwrite /usr/local/bin/convert?

I had the same problem, and after a bit of investigation, I'm pretty sure that the existing /usr/local/bin/convert was installed with MacTeX, which I did not install through homebrew. Replacing it with the homebrew installed 'convert' worked fine - you might want to back up the existing files beforehand just in case though.

Related

Change permissions access denied brew link imagemagick

Imagemagick was improperly installed on my computer. I have homebrew and when trying to link I encountered the same problems listed in this post
Caseys-MacBook-Pro:~ CaseyJayne$ brew link imagemagick
Linking /usr/local/Cellar/imagemagick/7.0.8-13...
Error: Could not symlink etc/ImageMagick-7/colors.xml
Target /usr/local/etc/ImageMagick-7/colors.xml already exists. You may want to remove it: rm '/usr/local/etc/ImageMagick-7/colors.xml'
To force the link and overwrite all conflicting files: brew link --overwrite imagemagick
To list all files that would be deleted:
brew link --overwrite --dry-run imagemagick
I tried force overwrite and it did not work.
Caseys-MacBook-Pro:~ CaseyJayne$ brew link --overwrite imagemagick
Linking /usr/local/Cellar/imagemagick/7.0.8-13...
Error: Could not symlink etc/ImageMagick-7/colors.xml
/usr/local/etc/ImageMagick-7 is not writable.
Caseys-MacBook-Pro:~ CaseyJayne$ brew link -f imagemagick
Linking /usr/local/Cellar/imagemagick/7.0.8-13...
Error: Could not symlink etc/ImageMagick-7/colors.xml
Target /usr/local/etc/ImageMagick-7/colors.xml
already exists. You may want to remove it:
rm '/usr/local/etc/ImageMagick-7/colors.xml'
To force the link and overwrite all conflicting files:
brew link --overwrite imagemagick
I tried removing and moving the files
Caseys-MacBook-Pro:~ CaseyJayne$ rm '/usr/local/etc/ImageMagick-7/colors.xml'
override rw-r--r-- root/wheel for /usr/local/etc/ImageMagick-7/colors.xml? yes
rm: /usr/local/etc/ImageMagick-7/colors.xml: Permission denied
Caseys-MacBook-Pro:~ CaseyJayne$ mv '/usr/local/etc/ImageMagick-7/colors.xml' ~/Desktop/
mv: rename /usr/local/etc/ImageMagick-7/colors.xml to /Users/CaseyJayne/Desktop/colors.xml: Permission denied
I tried changing permissions to 755 for the entire etc file, changing the directories to 755 and folders to 644, and deleting the entire file with rmdir (all listed in the linked posts' comments). I did the entire process again with the same output. I ran brew doctor and followed instructions on everything that had to do with imagemagick.
Currently, the dry run gives this output:
Caseys-MacBook-Pro:~ CaseyJayne$ brew link --overwrite --dry-run imagemagick
Would remove:
1020 files in the /usr/local/etc/ /usr/local/bin/ /usr/local/share/ directories and sub directories
examples:
/usr/local/etc/ImageMagick-7/colors.xml
/usr/local/bin/Magick++-config
/usr/local/share/ImageMagick-7/locale.xml
What is my best options for changing the permissions or removing the files?
Idea that makes me nervous: Manually show the hidden gui files, move them to the trash, run the brew link imagemagick, and then restore them from the trash into some other folder?
Also- no option has worked to uninstall imagemagick (sudo or yum at the beggining)
I am using a Mac OS High Sierra 10.13.6
Imagemagick 7.0.8-13
Homebrew 1.8.0
Your user have no rights on this file, but if you are admin of your computer you can remove it with sudo:
sudo rm '/usr/local/etc/ImageMagick-7/colors.xml'
Image Magick had a ton of files installed in my hidden files. My coworker (who's been coding for years, dual PhD in neuroscience and engineering) helped me go through and manually remove the ones that said "magick" in any form.
We did this one at a time, to make sure we wouldn't haphazardly delete something that was necessary. I've been using my computer for months now without problems and would say that this is the safest and most seamless way to do so. The ^above solution didn't uninstall all the the things imagemagick put into my computer, but only removed one item.

updating octave: linking the installation

I have OSX 10.10.5 with Octave 3.4.0 running (installed, who knows how, I did it a million different ways through port, file extraction, ftp, homebrew…). I tried to update my Programme (brew install octave or sudo port install octave) and Terminal spits out:
Warning: octave-3.8.2 already installed, it's just not linked
Okay, great. So I have a better programme somewhere installed. What now? How on earth am I supposed to “just link” the newer installation?
If you install octave with Homebrew and it doesn't link it it should tell you why. You can force Homebrew to link octave with
$ brew link --overwrite octave
You can also add the --dry-run option to check and see what Homebrew will do to link octave
$ brew link --overwrite --dry-run octave
A possible reason for Homebrew not linking octave is that you've installed it by another method, MacPorts for instance. It is not recommended that you use both Homebrew and MacPorts on the same system.

Error: You must `brew link pcre' before nginx can be installed

I've already seen this post. And it didn't seem to solve my issue. Here's what I get when I try to run brew install nginx --with-passenger
Error: You must `brew link pcre' before nginx can be installed
So I then tried cd /usr/local, followed by ls -l. All of the files are mine. So I don't see the need to call sudo chown $(whoami) /usr/local/<sub-foldername> I've then tried doing brew link pcre and yet I get another error. Error: Could not symlink bin/pcregrep I'm not really sure what to do now. Any ideas?
I was able to get it working by forcing it with. brew link --overwrite pcre This would force the link and overwrite all conflicting files.

How to fix `brew doctor` errors on Mac OSX 10.9 (unlinked kegs in Cellar and Homebrew sbin not found)?

I'm having some trouble with brew which I'm trying to solve. When I currently run brew doctor I get the following output:
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:
autoconf
libevent
Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so
echo export PATH="/usr/local/sbin:$PATH" >> ~/.bash_profile
So I went ahead and tried all the suggestions. First brew link autoconf, which results in:
Linking /usr/local/Cellar/autoconf/2.69... Warning: Could not link autoconf. Unlinking...
Error: Could not symlink file: /usr/local/Cellar/autoconf/2.69/share/emacs/site-lisp/autotest-mode.elc
Target /usr/local/share/emacs/site-lisp/autotest-mode.elc already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
brew link --overwrite formula_name
To list all files that would be deleted:
brew link --overwrite --dry-run formula_name
So again I tried the suggested command: brew link --overwrite autoconf:
Linking /usr/local/Cellar/autoconf/2.69... Warning: Could not link autoconf. Unlinking...
Error: Permission denied - /usr/local/share/emacs/site-lisp/autotest-mode.elc
My initial response to a permission denied is usually prepending it with sudo, which leads brew to tell me: Error: Cowardly refusing tosudo brew link`.
When trying brew link libevent I get the same results as with brew link autoconf.
Finally, I tried solving the sbin that was not found by running the suggested echo export PATH="/usr/local/sbin:$PATH" >> ~/.bash_profile. This runs without error, but when I run brew doctor again, the message still appears.
Does anybody know how I can solve these issues? All tips are welcome!
The general problem here is that autoconf and libevent are already installed on your system, and they are in your homebrew "Cellar" as well. Thus there are TWO copies of autoconf on your system, and TWO copies of libevent on your system.
What homebrew is trying to do is delete the previously install (system wide) version of these libraries, and replace all the relevant REAL files with symlinks from the homebrew Cellar. That would give homebrew full control over upgrading and managing these libraries for you. It would also give you just one copy of these libraries available in two places.
The problem is that homebrew doesn't have unix permissions to delete these REAL files, and you'll need to do it yourself. Here's how for autoconf:
$ sudo rm /usr/local/share/emacs/site-lisp/autotest-mode.elc
$ sudo chmod 777 /usr/local/share/emacs/site-lisp/
$ sudo rm -rf /usr/local/share/autoconf
$ brew link --overwrite autoconf
You should see:
Linking /usr/local/Cellar/autoconf/2.69... 21 symlinks created
UPDATE I just noticed the part about sbin. I'm not sure how this problem happened originally, but I can explain how to fix it.
The fix recommended by homebrew (ECHO ...) only takes effect when you next login to your Mac. To have this change take effect now, you have to force your terminal to re-read the .bash_profile file. Just $ source ~/.bash_profile after you run the ECHO command provided by homebrew.
Since this question is a few months old now, you probably already discovered that this error message has gone away.
Run the following commands to grant the privileges:
$ sudo chown -R $(whoami) /usr/local
Once the privileges are granted, now they have to be just linked since it is already installed:
$ brew link autoconf
$ brew link libevent
You may want to change writing permissions with chmod on /usr/local/share/emacs/site-lisp/autotest-mode.elc
After that you should get something like this:
Linking /usr/local/Cellar/autoconf/2.69... 21 symlinks created

tesseract install mac os

I am trying to install tesseract on my mac using homeBrew. When I try installing, everything seems to be good but I get the following error/message:
Warning: Could not link leptonica. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link leptonica'
When I try running a tesseract function, I get the following error:
Tesseract Open Source OCR Engine v3.02.02 with Leptonica
Error in pixReadStreamPng: function not present
Error in pixReadStream: png: no pix returned
Error in pixRead: pix not read
Unsupported image type.
I have image magick installed and the command I used to install tesseract was:
brew install tesseract
Can anyone please tell me what I can do to get tesseract working? Thank you!
EDIT
When I run brew link leptonica, I get the following error:
Could not symlink file: /usr/local/Cellar/leptonica/1.69/bin/yuvtest
Target /usr/local/bin/yuvtest already exists. You may need to delete it.
Now, as of September 2019, there are no longer any optional install flags available
brew options tesseract
yield nothing. But,
brew info tesseract
yields the following key info:
This formula contains only the "eng", "osd", and "snum" language data files.
If you need all the other supported languages, `brew install tesseract-lang`.
Therefore, to get all of the languages installed, you need to now install a separate library called tesseract-lang.
Updated installation:
brew install tesseract
brew install tesseract-lang
Hope this helps.
old in case this is useful:
Now, as of January 2019, Tesseract installs fine via homebrew, as long as you have xquartz installed first, brew cask install xquartz. Then you can do the following: brew install tesseract --with-all-languages --with-serial-num-pack --with-training-tools
After installing / removing and re-installing tesseract i found the solution for the same problem you have. On your terminal logs, while installing tesseract, you will see:
Error: The brew link step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/convertfilestopdf
Target /usr/local/bin/convertfilestopdf
already exists.
You may want to remove it:
rm '/usr/local/bin/convertfilestopdf'
To force the link and overwrite all conflicting files:
brew link --overwrite leptonica
To list all files that would be deleted:
brew link --overwrite --dry-run leptonica
What i did was running: brew link --overwrite leptonica
"Linking /usr/local/Cellar/leptonica/1.71_1... 45 symlinks created"
Everything should work perfectly.
Hope this can be a help for you
It sounds a bit silly, but have you tried deleting yuvtest? I just tried it myself - the file is automatically generated by brew link leptonica. As for why it isn't working, is it possible you had some version of leptonica/tesseract installed previously? Another reasonable guess at a fix would be
brew uninstall tesseract; brew install tesseract
So far as I know, image magick being installed shouldn't matter for tesseract. They don't have anything in common.
Tesseract is now dependent on Leptonica being installed.
The error messages you are seeing relate to these files:
Leptonica is configured to handle image I/O using these external libraries: libjpeg, libtiff, libpng, libz, libgif, libwebp.
These libraries are easy to obtain. For example, using the debian package manager:
sudo apt-get install
where = {libpng12-dev, libjpeg62-dev, libtiff4-dev}.
Source: Leptonica unofficial documentation
I found that homebrew would install some but not all of the libraries.

Resources