Refusing to link macOS-provided software: libiconv - homebrew

In an effort to follow the steps posted here to get nokogiri working, I seem unable to link iconv properly.
When I run the command
brew link libiconv
I receive the following error:
Warning: Refusing to link macOS-provided software: libiconv
If you need to have libiconv first in your PATH run:
echo 'export PATH="/usr/local/opt/libiconv/bin:$PATH"' >> ~/.bash_profile
For compilers to find libiconv you may need to set:
export LDFLAGS="-L/usr/local/opt/libiconv/lib"
export CPPFLAGS="-I/usr/local/opt/libiconv/include"
I've added the above paths to my bash profile, reloaded the terminal, restarted the terminal and even tried restarting the computer as well but the error still persists. I've also tried reinstalling libiconv but to no avail (see output below).
$ brew reinstall libiconv
==> Reinstalling libiconv
==> Downloading https://homebrew.bintray.com/bottles/libiconv-1.16.mojave.bottle.tar.gz
Already downloaded: /Users/sam/Library/Caches/Homebrew/downloads/203933f4d9f3c2f0463012d85013a6c01bdb89fc4d435341315b4537de1dba78--libiconv-1.16.mojave.bottle.tar.gz
==> Pouring libiconv-1.16.mojave.bottle.tar.gz
==> Caveats
libiconv is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have libiconv first in your PATH run:
echo 'export PATH="/usr/local/opt/libiconv/bin:$PATH"' >> ~/.bash_profile
For compilers to find libiconv you may need to set:
export LDFLAGS="-L/usr/local/opt/libiconv/lib"
export CPPFLAGS="-I/usr/local/opt/libiconv/include"
==> Summary
🍺 /usr/local/Cellar/libiconv/1.16: 30 files, 2.4MB

libiconv is keg-only.
❯ brew info libiconv
libiconv: stable 1.16 (bottled) [keg-only]
Conversion library
https://www.gnu.org/software/libiconv/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libiconv.rb
==> Caveats
libiconv is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
In the post link given by you, linking libiconv is unneeded. Cause only the real installation location is used but not the linked one. Just skip this link step and run following command,
# use the real installation location is not preferred, cause it will
# break you once the libiconv is upgraded to a new version
gem install nokogiri -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.16
# you'd better pass the dir "/usr/local/opt/libiconv",
# which serves as a link to the real installation location.
gem install nokogiri -- --with-iconv-dir=/usr/local/opt/libiconv

Related

brew cannot install go#1.13 while brew search shows it

I am seeing on my mac the the following weird situation
$ brew search go#1.13
==> Formulae
go#1.13
and
$ brew install go#1.13
Error: go#1.13: unknown keyword: because
Also the error message is weird (it doesn't seem to complete the sentence.) I can brew install go#1.14 without any problem.
Please help provide some clues. Thank you.
That looks like your brew is not up to date. Can you run brew update to ensure everything is up to date before running brew install go#1.13? That would probably solve your issue.
Here is my installation test:
$ brew install go#1.13
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 15 formulae.
Warning: go#1.13 has been deprecated because it is not supported upstream!
==> Downloading https://homebrew.bintray.com/bottles/go%401.13-1.13.15.mojave.bottle.1.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/d994ff2b27c191bb74dd44a373e254ef92472c1cb13e381cf6bf9d3d118
######################################################################## 100.0%
==> Pouring go#1.13-1.13.15.mojave.bottle.1.tar.gz
==> Caveats
go#1.13 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have go#1.13 first in your PATH run:
echo 'export PATH="/usr/local/opt/go#1.13/bin:$PATH"' >> /Users/rchen/.bash_profile
==> Summary
🍺 /usr/local/Cellar/go#1.13/1.13.15: 9,282 files, 414.5MB

cannot install llvm using homebrew on macOS mojave

System: macOS mojave 10.14.6
when I use brew install llvm, this error appears:
Error: cmake: undefined method `on_linux' for #<Class:0x00007f7f744bf6b8>
I happened to have a Mojave machine and re-did the installation process myself, and it works fine.
Here is what I did:
brew install llvm (I actually used brew reinstall llvm, since it is reinstall for me)
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile, brew version would be on your PATH
source ~/.bash_profile, apply the PATH change
The full installation log:
$ brew reinstall llvm
==> Downloading https://homebrew.bintray.com/bottles/llvm-10.0.0_3.moj
Already downloaded: /Users/rchen/Library/Caches/Homebrew/downloads/6d4c3816f98949b64550d4a36656b2661f8e5aeea36a90abbdbea68c8215b9a2--llvm-10.0.0_3.mojave.bottle.tar.gz
==> Reinstalling llvm
==> Pouring llvm-10.0.0_3.mojave.bottle.tar.gz
==> Caveats
To use the bundled libc++ please add the following LDFLAGS:
LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
llvm is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have llvm first in your PATH run:
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> /Users/rchen/.bash_profile
For compilers to find llvm you may need to set:
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
==> Summary
🍺 /usr/local/Cellar/llvm/10.0.0_3: 7,055 files, 1GB
test log (after PATH change):
$ clang --version
clang version 10.0.0
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

Warnings when running meld on Mac OS X Sierra

I've installed homebrew on my machine. Using brew I've installed meld. When I run it with git I get the following error:
Couldn't bind the translation domain. Some translations won't work.
'module' object has no attribute 'bindtextdomain'
2016-10-20 10:14:08.422 Python[22212:158273] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
(meld:22212): Gdk-WARNING **: GdkQuartzDisplay does not implement the monitor vfuncs
I don't understand how exactly brew works. In fact I never dug into its code, used it only to (un)install the software.
Did some online searches but there doesn't seem to be a solution to this. Has anyone figured it out?
Homebrew is simply a a package manager for MacOS. Unlike Linux, Mac doesn't always have all the external libraries you may need for things like wget, pip, etc out of the box. Homebrew tries to bridge this gap.
As for troubleshooting your issue, following Homebrew's troubleshooting steps helped me... You are probably just stuck in dependency hell, since Homebrew integrates alot of its libraries with Xcode (for me it was needing to update Xcode to latest): https://github.com/Homebrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting
It's really important to keep thing up-to-date with brew update and then running brew doctor and brew prune resolved alot of issues for me as well.
If all else fails, homebrew seemed to have moved the meld formulae from homebrew/core to caskroom/cask. So I recall having to run the following command after running brew doctor and updating Xcode:
$ brew uninstall meld
$ brew install meld
Error: No available formula with the name "meld"
It was migrated from homebrew/core to caskroom/cask.
You can access it again by running:
brew tap caskroom/cask
$ brew tap caskroom/cask
$ brew cask install meld
==> Downloading https://github.com/yousseb/meld/releases/download/osx-9/meldmerge.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask meld
==> Moving App 'Meld.app' to '/Applications/Meld.app'.
==> Linking Binary 'Meld' to '/usr/local/bin/meld'.
🍺 meld was successfully installed!

Using Brew to Install rbenv

I'm trying to take a coursera class on Ruby from Johns Hopkins. The Mac OSX set up instructions require that I download homebrew and then install rbenv. I already have brew installed from stuff I had done a long time back, so perhaps this issue is because I screwed up installing ruby/brew a long time ago.
Here's the command that's giving me issues: brew install rbenv ruby-build
the response i get is this:
Warning: rbenv-0.4.0 already installed, it's just not linked
==> Installing dependencies for ruby-build: pkg-config, openssl
Error: Cannot link pkg-config
Another version is already linked: /usr/local/Cellar/pkg-config/0.28
Update: Here's what appeared after running brew doctor:
Warning: /usr/local/bin isn't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.
You should probably change the ownership and permissions of /usr/local/bin
back to your user account.
sudo chown -R $(whoami) /usr/local/bin
Warning: /usr/local/share isn't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.
You should probably change the ownership and permissions of /usr/local/share
back to your user account.
sudo chown -R $(whoami) /usr/local/share
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 `sudo chown -R $(whoami)` them:
/usr/local/share/man
/usr/local/share/man/man1
/usr/local/share/man/man5
/usr/local/share/man/mann
Warning: Broken symlinks were found. Remove them with `brew prune`:
/usr/local/bin/2to3-3.3
/usr/local/bin/apm
/usr/local/bin/atom
/usr/local/bin/idle3.3
/usr/local/bin/python3.3-32
/usr/local/bin/pythonw3
/usr/local/bin/pythonw3-32
/usr/local/bin/pythonw3.3
/usr/local/bin/pythonw3.3-32
/usr/local/bin/pyvenv-3.3
/usr/local/bin/subl
Warning: Python is installed at /Library/Frameworks/Python.framework
Homebrew only supports building against the System-provided Python or a
brewed Python. In particular, Pythons installed to /Library can interfere
with other software installs.
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libMonoPosixHelper.dylib
/usr/local/lib/libSFFileMonitor.32.dylib
/usr/local/lib/libSFIPC.32.dylib
/usr/local/lib/libSFIPC.I.dylib
/usr/local/lib/libSFsqlite3.7.4.dylib
/usr/local/lib/libSFSyncEngine.I.dylib
/usr/local/lib/libtcl8.6.dylib
/usr/local/lib/libtk8.6.dylib
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
/usr/local/include/fakemysql.h
/usr/local/include/fakepq.h
/usr/local/include/fakesql.h
/usr/local/include/itcl.h
/usr/local/include/itcl2TclOO.h
/usr/local/include/itclDecls.h
/usr/local/include/itclInt.h
/usr/local/include/itclIntDecls.h
/usr/local/include/itclMigrate2TclCore.h
/usr/local/include/itclTclIntStubsFcn.h
/usr/local/include/mysqlStubs.h
/usr/local/include/node/ares.h
/usr/local/include/node/ares_version.h
/usr/local/include/node/nameser.h
/usr/local/include/node/node.h
/usr/local/include/node/node_buffer.h
/usr/local/include/node/node_internals.h
/usr/local/include/node/node_object_wrap.h
/usr/local/include/node/node_version.h
/usr/local/include/node/openssl/opensslconf.h
/usr/local/include/node/uv-private/ngx-queue.h
/usr/local/include/node/uv-private/stdint-msvc2008.h
/usr/local/include/node/uv-private/tree.h
/usr/local/include/node/uv-private/uv-bsd.h
/usr/local/include/node/uv-private/uv-darwin.h
/usr/local/include/node/uv-private/uv-linux.h
/usr/local/include/node/uv-private/uv-sunos.h
/usr/local/include/node/uv-private/uv-unix.h
/usr/local/include/node/uv-private/uv-win.h
/usr/local/include/node/uv.h
/usr/local/include/node/v8-debug.h
/usr/local/include/node/v8-preparser.h
/usr/local/include/node/v8-profiler.h
/usr/local/include/node/v8-testing.h
/usr/local/include/node/v8.h
/usr/local/include/node/v8stdint.h
/usr/local/include/node/zconf.h
/usr/local/include/node/zlib.h
/usr/local/include/odbcStubs.h
/usr/local/include/pqStubs.h
/usr/local/include/tcl.h
/usr/local/include/tclDecls.h
/usr/local/include/tclOO.h
/usr/local/include/tclOODecls.h
/usr/local/include/tclPlatDecls.h
/usr/local/include/tclThread.h
/usr/local/include/tclTomMath.h
/usr/local/include/tclTomMathDecls.h
/usr/local/include/tdbc.h
/usr/local/include/tdbcDecls.h
/usr/local/include/tdbcInt.h
/usr/local/include/tk.h
/usr/local/include/tkDecls.h
/usr/local/include/tkPlatDecls.h
Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .pc files:
/usr/local/lib/pkgconfig/tcl.pc
/usr/local/lib/pkgconfig/tk.pc
Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected static libraries:
/usr/local/lib/libtclstub8.6.a
/usr/local/lib/libtkstub8.6.a
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:
rbenv
Warning: You have uncommitted modifications to Homebrew
If this is a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
cd /usr/local/Library && git stash && git clean -d -f
Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
2to3
2to3-2.7
easy_install
easy_install-2.7
idle
idle2.7
info
infokey
install-info
makeinfo
pydoc
pydoc2.7
python
python-config
python2.7
python2.7-config
pythonw
pythonw2.7
smtpd.py
smtpd2.7.py
tclsh
tclsh8.5
texi2dvi
texi2pdf
texindex
wish
wish8.5
Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile`
New Update:
I did brew prune, changed ownership of the files that it suggested (some of them could not be found). Finally, when i run brew install rbenv ruby-build i get the following errors:
Warning: rbenv-0.4.0 already installed, it's just not linked
Warning: ruby-build-20151028 already installed
The next step would be to do rbenv install 2.2.3, but rbenv command is not found. Seems that the installation failed somehow. which rbenv also produced no output.
According to brew doctor, you can't edit the directories that it's trying to install files to. Try running
sudo chown -R $(whoami) /usr/local/bin
etc, like brew doctor is telling you:
You should probably change the ownership and permissions of /usr/local/share
back to your user account.
sudo chown -R $(whoami) /usr/local/share
EDIT:
You might want to take a look at this part of the output to list the things you need to run the command on.
You should probably `sudo chown -R $(whoami)` them:
/usr/local/share/man
/usr/local/share/man/man1
/usr/local/share/man/man5
/usr/local/share/man/mann

Have problems installing imagemagick in particular with brew link libtiff

Basically I am trying to install imagemagick using brew and got the following error.
[~]$ brew install imagemagick
==> Installing imagemagick dependency: libtiff
==> Downloading http://download.osgeo.org/libtiff/tiff-4.0.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/libtiff-4.0.1.tar.gz
==> ./configure --prefix=/usr/local/Cellar/libtiff/4.0.1
==> make install
Error: The linking step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link libtiff'
==> Summary
/usr/local/Cellar/libtiff/4.0.1: 239 files, 3.7M, built in 42 seconds
Error: You must `brew link libtiff' before little-cms can be installed
[~]$ brew link libtiff
Linking /usr/local/Cellar/libtiff/4.0.1...
Error: Could not symlink file: /usr/local/Cellar/libtiff/4.0.1/share/man/man3/TIFFWriteDirectory.3tiff
Target /usr/local/share/man/man3/TIFFWriteDirectory.3tiff already exists. You may need to delete it.
Everytime I remove one, I get the error message asking me to remove another file. I have already removed like 20 of those files and I am not sure how many more are there. Is there a easier way of doing this?
Appreciate any advice.
Try this...
> brew link --overwrite libtiff

Resources