I'm Vinh, a husband, father& programing enthusiat

brew pkg config

Vinh  mac brew

The other day I want to upgrade NodeJS with homebrew. It complains about pkg-config linking. I tried to link it, remove it, reinstall. All is fine. I can see pkg-config in my path. But it keeps complaining about pkg-config missing.

So here is how I fix it.

I run brew doctor and got this result.

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Your XQuartz (2.7.7) is outdated.
Please install XQuartz 2.7.9 (or delete the current version).
XQuartz can be updated using Homebrew-Cask by running
  brew cask reinstall xquartz

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/libarena-4e7c5e5c.dylib
  /usr/local/lib/libflate-4e7c5e5c.dylib
  /usr/local/lib/libfmt_macros-4e7c5e5c.dylib
  /usr/local/lib/libgetopts-4e7c5e5c.dylib
  /usr/local/lib/libgraphviz-4e7c5e5c.dylib
  /usr/local/lib/liblog-4e7c5e5c.dylib
  /usr/local/lib/librbml-4e7c5e5c.dylib
  /usr/local/lib/librustc-4e7c5e5c.dylib
  /usr/local/lib/librustc_back-4e7c5e5c.dylib
  /usr/local/lib/librustc_borrowck-4e7c5e5c.dylib
  /usr/local/lib/librustc_driver-4e7c5e5c.dylib
  /usr/local/lib/librustc_lint-4e7c5e5c.dylib
  /usr/local/lib/librustc_llvm-4e7c5e5c.dylib
  /usr/local/lib/librustc_privacy-4e7c5e5c.dylib
  /usr/local/lib/librustc_resolve-4e7c5e5c.dylib
  /usr/local/lib/librustc_trans-4e7c5e5c.dylib
  /usr/local/lib/librustc_typeck-4e7c5e5c.dylib
  /usr/local/lib/librustdoc-4e7c5e5c.dylib
  /usr/local/lib/libserialize-4e7c5e5c.dylib
  /usr/local/lib/libstd-4e7c5e5c.dylib
  /usr/local/lib/libsyntax-4e7c5e5c.dylib
  /usr/local/lib/libterm-4e7c5e5c.dylib
  /usr/local/lib/libtest-4e7c5e5c.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/kore/http.h
  /usr/local/include/kore/kore.h
  /usr/local/include/kore/pgsql.h
  /usr/local/include/kore/spdy.h
  /usr/local/include/kore/tasks.h
  /usr/local/include/ublio.h

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:
  ack
  apple-gcc42
  atk
  atkmm
  autoconf
  automake
  awscli
  bazaar
  bdw-gc
  boost
  cairo
  cairomm
  carthage
  chicken
  cmake
  collectd
  coreutils
  cscope
  ctags
  czmq
  dirmngr
  dnsmasq
  drafter
  drone
  dropbear
  dynamodb-local
  elasticsearch
  elixir
  erlang
  expect
  fish
  fontconfig
  fontforge
  freetype
  fswatch
  gcc48
  gd
  gdbm
  gdk-pixbuf
  geoip
  ghostscript
  git
  git-crypt
  git-flow
  git-radar
  glib
  glibmm
  gmp
  gnupg
  gnupg2
  gnuplot
  gnutls
  go
  gobject-introspection
  gpg-agent
  gradle
  gsl
  gtk+
  gtkmm
  haproxy
  harfbuzz
  hicolor-icon-theme
  htop-osx
  imagemagick
  influxdb
  inkscape
  iperf
  iperf3
  jbig2dec
  jpeg
  jq
  json-c
  kyoto-cabinet
  lastpass-cli
  leveldb
  libassuan
  libconfig
  libcroco
  libevent
  libgcrypt
  libgpg-error
  libksba
  libmagic
  libpng
  librsvg
  libsigc++
  libtasn1
  libtiff
  libtool
  libusb
  libusb-compat
  libyaml
  libyubikey
  little-cms
  little-cms2
  lua
  luajit
  luarocks
  lz4
  macvim
  mariadb
  maven
  mcrypt
  memcached
  mercurial
  mhash
  mobile-shell
  mongodb
  multitail
  mysql56
  neovim
  netcat
  nettle
  nginx
  nmap
  nsq
  oniguruma
  packer
  pango
  pangomm
  pass
  pcre
  pcre2
  percona-toolkit
  perl
  phantomjs
  php70
  php70-mcrypt
  pinentry
  pixman
  pkg-config
  popt
  postgresql
  ppl011
  protobuf
  pth
  putty
  pwgen
  python
  qt
  rabbitmq
  reattach-to-user-namespace
  redis
  rethinkdb
  rocksdb
  ruby
  s3cmd
  siege
  snappy
  sphinx
  stow
  strongswan
  sup
  supervisor
  telegraf
  the_silver_searcher
  tmate
  tmux
  tree
  tsung
  unixodbc
  unrar
  vim
  vnstat
  w3m
  watch
  watchman
  wget
  wireshark
  wrk
  wxmac
  xz
  ykpers
  zeromq

Warning: Some directories in your path end in a slash.
Directories in your path should not end in a slash. This can break other
doctor checks. The following directories should be edited:
  /Users/kureikain/go/bin/
  /Users/kureikain/Applications/love.app/Contents/MacOS/
  /Users/kureikain/Sites/Homestead/
  /Users/kureikain/Sites/devops-scripts/aws/

Warning: Your Xcode (8.0) is outdated.
Please update to Xcode 8.2 (or delete it).
Xcode can be updated from the App Store.


Warning: Broken symlinks were found. Remove them with `brew prune`:
  /usr/local/bin/jsplora
  /usr/local/share/man/man1/npm-README.1
  /usr/local/share/man/man1/npm-access.1
  /usr/local/share/man/man1/npm-adduser.1
  /usr/local/share/man/man1/npm-bin.1
  /usr/local/share/man/man1/npm-bugs.1
  /usr/local/share/man/man1/npm-build.1
  /usr/local/share/man/man1/npm-bundle.1
  /usr/local/share/man/man1/npm-cache.1
  /usr/local/share/man/man1/npm-completion.1
  /usr/local/share/man/man1/npm-config.1
  /usr/local/share/man/man1/npm-dedupe.1
  /usr/local/share/man/man1/npm-deprecate.1
  /usr/local/share/man/man1/npm-dist-tag.1
  /usr/local/share/man/man1/npm-docs.1
  /usr/local/share/man/man1/npm-edit.1
  /usr/local/share/man/man1/npm-explore.1
  /usr/local/share/man/man1/npm-help-search.1
  /usr/local/share/man/man1/npm-help.1
  /usr/local/share/man/man1/npm-init.1
  /usr/local/share/man/man1/npm-install-test.1
  /usr/local/share/man/man1/npm-install.1
  /usr/local/share/man/man1/npm-link.1
  /usr/local/share/man/man1/npm-logout.1
  /usr/local/share/man/man1/npm-ls.1
  /usr/local/share/man/man1/npm-outdated.1
  /usr/local/share/man/man1/npm-owner.1
  /usr/local/share/man/man1/npm-pack.1
  /usr/local/share/man/man1/npm-ping.1
  /usr/local/share/man/man1/npm-prefix.1
  /usr/local/share/man/man1/npm-prune.1
  /usr/local/share/man/man1/npm-publish.1
  /usr/local/share/man/man1/npm-rebuild.1
  /usr/local/share/man/man1/npm-repo.1
  /usr/local/share/man/man1/npm-restart.1
  /usr/local/share/man/man1/npm-root.1
  /usr/local/share/man/man1/npm-run-script.1
  /usr/local/share/man/man1/npm-search.1
  /usr/local/share/man/man1/npm-shrinkwrap.1
  /usr/local/share/man/man1/npm-star.1
  /usr/local/share/man/man1/npm-stars.1
  /usr/local/share/man/man1/npm-start.1
  /usr/local/share/man/man1/npm-stop.1
  /usr/local/share/man/man1/npm-tag.1
  /usr/local/share/man/man1/npm-team.1
  /usr/local/share/man/man1/npm-test.1
  /usr/local/share/man/man1/npm-uninstall.1
  /usr/local/share/man/man1/npm-unpublish.1
  /usr/local/share/man/man1/npm-update.1
  /usr/local/share/man/man1/npm-version.1
  /usr/local/share/man/man1/npm-view.1
  /usr/local/share/man/man1/npm-whoami.1
  /usr/local/share/man/man1/npm.1
  /usr/local/share/man/man5/npm-folders.5
  /usr/local/share/man/man5/npm-global.5
  /usr/local/share/man/man5/npm-json.5
  /usr/local/share/man/man5/npmrc.5
  /usr/local/share/man/man5/package.json.5
  /usr/local/share/man/man7/npm-coding-style.7
  /usr/local/share/man/man7/npm-config.7
  /usr/local/share/man/man7/npm-developers.7
  /usr/local/share/man/man7/npm-disputes.7
  /usr/local/share/man/man7/npm-index.7
  /usr/local/share/man/man7/npm-orgs.7
  /usr/local/share/man/man7/npm-registry.7
  /usr/local/share/man/man7/npm-scope.7
  /usr/local/share/man/man7/npm-scripts.7
  /usr/local/var/homebrew/linked/hugo
  /usr/local/var/homebrew/linked/node
  /usr/local/var/homebrew/linked/php56-mcrypt

Warning: Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:
  brew install dbus gflags gperftools libssh libtermkey libuv libvterm msgpack net-snmp qt5 shared-mime-info unibilium webp

Run `brew missing` for more details.

So, first I save them into a file:

for f in `cat a`; do echo "remove $f"; brew link $f; done

I then install package:

brew install dbus gflags gperftools libssh libtermkey libuv libvterm msgpack net-snmp qt5 shared-mime-info unibilium webp

But still failing. It seems I’m in a horrible broken state.

At this point, I try to cd into /usr/local/ and realize I don’t have a .git folder here. I remeber some change about homebrew the other day. I went to their github repo and did this:

cd "$(brew --repo)" && git fetch && git reset --hard origin/master &&
brew update

The next thing is it complains about this

Error: No such file or directory - /Volumes/nyanko/brew/Cellar

This is what my folder looks like:

drwxr-xr-x   195 kureikain  admin   6630 Dec 21 10:18 Cellar
drwxr-xr-x    22 kureikain  admin    748 Dec  2 20:59 Frameworks
drwxr-xr-x    17 kureikain  admin    578 Dec 21 10:21 Homebrew
drwxr-xr-x     6 root       wheel    204 Jun 28 05:18 MacGPG2
drwxr-xr-x     6 root       admin    204 Dec 22  2015 aws
drwxr-xr-x  1096 kureikain  admin  37264 Dec 21 10:19 bin
drwxr-xr-x    48 kureikain  admin   1632 Dec 21 10:07 etc
drwxr-xr-x   275 kureikain  admin   9350 Dec 21 10:07 include
drwxr-xr-x   699 kureikain  admin  23766 Dec 21 10:07 lib
drwxr-xr-x   196 kureikain  admin   6664 Dec 21 10:19 opt
drwxr-xr-x    20 kureikain  admin    680 Dec 21 10:05 sbin
drwxr-xr-x    69 kureikain  admin   2346 Dec 21 10:19 share
drwxr-xr-x     3 kureikain  admin    102 May 24  2015 texlive
lrwxr-xr-x     1 kureikain  admin     24 Sep  2  2015 var -> /Volumes/nyanko/brew/var

I have so much data on our local mysql, mongodb, elasticsearch and I have to put them into that folder and do a symlink, which turns out a bad idea because homebrew seems not play nice with symlink.

I unlink and move everything back and stuff started to work again. After thing started to work, I go into my /Volumes/nyanko/brew/var and symlink everything back like this:

lrwxr-xr-x   1 kureikain  staff    17 Jan  5 09:36 Cellar -> /usr/local/Cellar
lrwxr-xr-x   1 kureikain  staff    21 Dec 21 11:47 Frameworks -> /usr/local/Frameworks
lrwxr-xr-x   1 kureikain  staff    19 Dec 21 11:47 Homebrew -> /usr/local/Homebrew
lrwxr-xr-x   1 kureikain  staff    18 Dec 21 11:47 MacGPG2 -> /usr/local/MacGPG2
lrwxr-xr-x   1 kureikain  staff    14 Dec 21 11:47 aws -> /usr/local/aws
lrwxr-xr-x   1 kureikain  staff    14 Dec 21 11:47 bin -> /usr/local/bin
lrwxr-xr-x   1 kureikain  staff    14 Dec 21 11:47 etc -> /usr/local/etc
lrwxr-xr-x   1 kureikain  staff    18 Dec 21 11:47 include -> /usr/local/include
lrwxr-xr-x   1 kureikain  staff    14 Dec 21 11:47 lib -> /usr/local/lib
lrwxr-xr-x   1 kureikain  staff    14 Dec 21 11:47 opt -> /usr/local/opt
lrwxr-xr-x   1 kureikain  staff    15 Dec 21 11:47 sbin -> /usr/local/sbin
lrwxr-xr-x   1 kureikain  staff    16 Dec 21 11:47 share -> /usr/local/share
lrwxr-xr-x   1 kureikain  staff    18 Dec 21 11:47 texlive -> /usr/local/texlive
drwxr-xr-x  15 kureikain  staff   544 Dec 21 10:37 var

I feel like homebrew is too much trouble to use. When it’s work, it works great but when it doesn’t, it’s horrible. I’m not sure if I can do something better but I want to try out an idea that I have in mind. Stay tune.