Installing elixir with homebrew fails due to jpeg - homebrew

I'm trying to install elixir and it fails installing one of its dependencies, jpeg:
$ brew install elixir
==> Installing dependencies for elixir: jpeg, libtiff, wxmac, erlang
Error: /usr/local/Library/LinkedKegs/jpeg is not a valid keg
So of course I try brew install jpeg and a few others:
$ brew install jpeg
Error: jpeg-jpeg already installed
To install this version, first `brew unlink jpeg'
$ brew unlink jpeg
Error: No such keg: /usr/local/Cellar/jpeg
$ brew info jpeg
jpeg: stable 8d (bottled)
JPEG image manipulation library
http://www.ijg.org
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/jpeg.rb
==> Options
--universal
Build a universal binary
And if I run brew doctor, it just tells me to install jpeg. Has anyone run into this before? I'm on Yosemite 10.10.5. I didn't expect to see jpeg-jpeg already installed after trying to install jpeg.
My brew --config:
$ brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: 070b76df5a4096dcc6196fc51e56185ae7dfd617
Last commit: 80 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit broadwell
OS X: 10.10.5-x86_64
Xcode: 7.1
CLT: 7.1.0.0.1.1444952191
Clang: 7.0 build 700
X11: N/A
System Ruby: 2.0.0-p481
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/Me/.rbenv/shims/ruby => /Users/Me/.rbenv/versions/2.1.2/bin/ruby
Java: 1.8.0_51, 1.6.0_65-b14-468
Updated with brew remove --force jpeg:
$ brew remove --force jpeg
$ brew install jpeg
Error: jpeg-jpeg already installed
To install this version, first `brew unlink jpeg'

I ended up getting this to work by following guidance in https://github.com/Homebrew/homebrew/issues/37250. Specifically, this comment. Following that, I just removed the directory at /usr/local/Library/LinkedKegs/jpeg and was then able to install jpeg just fine.

Related

Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)

I tried to upgrade with Brew
$ brew upgrade stripe/stripe-cli/stripe
I got:
Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
arch -arm64 brew install ...
To install under x86_64, install Homebrew into /usr/local.
AS suggested, I tried
$ arch -arm64 brew install
But got:
Error: Invalid usage: This command requires at least 1 formula or cask argument.
I tried installing Rosetta 2 according to this tutorial
$ /usr/sbin/softwareupdate --install-rosetta --agree-to-license
But I got:
Installing Rosetta 2 on this system is not supported.
Seems homebrew has to be used like this from now on:
arch -arm64 brew upgrade
I added the original argument to arch -arm64 brew upgrade and it worked
$ arch -arm64 brew upgrade stripe/stripe-cli/stripe
Well, all other answers seemed like a workaround for me, I would recommend to do this
cd /opt
sudo mkdir homebrew
sudo chown $(whoami):admin homebrew
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
Then just reload terminal and your brew install xxx should work just fine.

Can't install nano via homebrew on m1 Mac

My main goal was to have syntax highlighting for nano.
Apparently my nano seems to be pico 5.09 instead of nano.
Running which nano, returns:
/usr/bin/nano
Then I tried to install the real nano with brew, there I get this error:
Warning: Treating nano as a formula. For the cask, use homebrew/cask/nano
Error: nano dependencies not built for the arm64 CPU architecture:
gettext was built for x86_64
I think brew looks like the legit arm version.
which brew
/opt/homebrew/bin/brew
What could I do to have the end result of
Nano with syntax highlighting?
If your brew dependencies are out of date, this could happen.
% brew update && brew upgrade && brew install nano
Already up-to-date.
...
% brew install nano
Warning: Treating nano as a formula. For the cask, use homebrew/cask/nano
==> Downloading https://ghcr.io/v2/homebrew/core/nano/manifests/6.4
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/nano/blobs/sha256:7206f1c20ac7f
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Pouring nano--6.4.arm64_monterey.bottle.tar.gz
==> nano cask is installed, skipping link.
🍺 /opt/homebrew/Cellar/nano/6.4: 103 files, 3.2MB
==> Running `brew cleanup nano`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

Unable to install Rmagick

I am installing rmagick in mac system, I have installed imagemagick version 7 by using the command brew install imagemagick , now I am executing gem install rmagick but I am getting the below error.
Can't install RMagick 2.16.0. Can't find MagickWand.h.
I have added export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH" in my bashfile but no luck
Finally , I downgraded the version of imagemagick to make it working i.e.
brew uninstall imagemagick
brew uninstal imagemagick#6
Then, set the path for MagicWand & MagicCore.h
export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick\#6/6.9.7-6/lib/pkgconfig/
Try uninstalling ImageMagick and re-installing with the --build-from-source option and that will get you the header you seek:
brew rm imagemagick
brew install imagemagick --build-from-source <ANY OTHER OPTIONS>
Now check you have it:
find /usr -name "MagickWand.h"
/usr/local/Cellar/imagemagick/7.0.4-6/include/ImageMagick-7/MagickWand/MagickWand.h

How can I force homebrew to recompile?

I'm trying to install wxWidgets on Mac OS X 10.9. It's already installed, but I'm having the problem described here. Someone suggested to add ENV.append_to_cflags "-stdlib=libc++". I did, but I'm not able to recompile the code.
$ brew install wxmac
Warning: wxmac-3.0.0 already installed
$ brew edit wxmac
=> ok, modifications done, now I want to recompile and reinstall
$ brew uninstall wxmac
Uninstalling /usr/local/Cellar/wxmac/3.0.0...
$ brew install wxmac
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/wxmac- 3.0.0.mavericks.bottle.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/wxmac-3.0.0.mavericks.bottle.2.tar.gz
==> Pouring wxmac-3.0.0.mavericks.bottle.2.tar.gz
🍺 /usr/local/Cellar/wxmac/3.0.0: 775 files, 41M
How can I force homebrew to recompile?
Homebrew is installing wxmac in bottle form (a pre-compiled binary of wxmac). To build from source, add the --build-from-source flag when calling brew install:
$ brew install --build-from-source wxmac
To rebuild all installed FORMULAE from source:
$ brew list | xargs brew reinstall --build-from-source

Homebrew keeps telling me to update but it does not let me update

$ brew doctor
Warning: Your Homebrew is outdated
You haven't updated for at least 24 hours, this is a long time in brewland!
Then:
$ brew update
$ brew --config
HOMEBREW_VERSION: 0.9
HEAD: (none)
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit sandybridge
OS X: 10.7.3
Kernel Architecture: x86_64
Xcode: 4.3.2
GCC-4.0: N/A
GCC-4.2: build 5666
LLVM: build 2335
Clang: 2.1 build 163
MacPorts or Fink? false
X11: /usr/X11
System Ruby: 1.8.7-249
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Which Perl: /usr/bin/perl
Which Python: /usr/local/bin/python => /System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
Which Ruby: /Users/luis/.rvm/rubies/ruby-1.9.2-p318/bin/ruby
This happend in my other mac and I when I brew upgrade brew outdated nothing happened.
I am afraid this will do the same even dough is a new installation.
how can I fix this?
Instead of using brew upgrade did you tried using brew update. It solved the problem for me.
There are differences between brew update and brew upgrade
brew update
Updates your local database of available (and no longer available) installable packages otherwise know in brew terminology as Formulae.
brew upgrade
Updates all the installed packages on your system currently. E.g. Upgrading PHP 5.3.20 to 5.3.21.
I don't see an error after you try to update, if you update and then run brew doctor again and it doesn't show the out of date error anymore then you are fully up to date.

Resources