chmod -R 777 /usr/local/
GMac:~ XXXX$ brew install cmake
==> Installing cmake dependency: xz
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/xz-5.2.0.yo
######################################################################## 100.0%
==> Pouring xz-5.2.0.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/lzma
/usr/local/include is not writable.
You can try again using:
brew link xz
==> Summary
🍺 /usr/local/Cellar/xz/5.2.0: 59 files, 1.7M
==> Installing cmake
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/cmake-3.1.1
######################################################################## 100.0%
==> Pouring cmake-3.1.1_1.yosemite.bottle.tar.gz
🍺 /usr/local/Cellar/cmake/3.1.1_1: 1821 files, 30M
GMac:~ XXXX$ cmake
dyld: Library not loaded: /usr/local/lib/liblzma.5.dylib
Referenced from: /usr/local/bin/cmake
Reason: Incompatible library version: cmake requires version 8.0.0 or later, but liblzma.5.dylib provides version 6.0.0
Trace/BPT trap: 5
GMac:~ XXXX$
GMac:~ XXXX$ brew install xz
Warning: xz-5.2.0 already installed, it's just not linked
GMac:~ XXXX$ brew link xz
Linking /usr/local/Cellar/xz/5.2.0...
Error: Could not symlink include/lzma
/usr/local/include is not writable.
GMac:~ XXXX$ sudo brew link xz
Password:
Error: Cowardly refusing to `sudo brew link`
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.
GMac:~ XXXX$ su -
Password:
GMac:~ root# brew link xz
Error: Cowardly refusing to `sudo brew link`
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.
GMac:~ root# quit
-sh: quit: command not found
GMac:~ root# exit
logout
GMac:~ XXXX$ brew link xz
Linking /usr/local/Cellar/xz/5.2.0...
Error: Could not symlink include/lzma
/usr/local/include is not writable.
GMac:~ XXXX$ ls /usr/local/include/
evdns.h event2 evrpc.h
event.h evhttp.h evutil.h
GMac:~ XXXX$ ls /usr/local/include/ -all
ls: -all: No such file or directory
/usr/local/include/:
evdns.h event2 evrpc.h
event.h evhttp.h evutil.h
GMac:~ XXXX$ ls -all /usr/local/include/
total 40
drwxr-xr-x 8 root admin 272 2 7 10:13 .
drwxrwxr-x 20 root admin 680 2 7 10:13 ..
-rw-r--r--@ 1 root admin 1974 2 7 10:13 evdns.h
-rw-r--r--@ 1 root admin 2760 2 7 10:13 event.h
drwxr-xr-x 27 root admin 918 2 7 10:13 event2
-rw-r--r--@ 1 root admin 1990 2 7 10:13 evhttp.h
-rw-r--r--@ 1 root admin 1970 2 7 10:13 evrpc.h
-rw-r--r--@ 1 root admin 1737 2 7 10:13 evutil.h
GMac:~ XXXX$ brew link xz
Linking /usr/local/Cellar/xz/5.2.0...
Error: Could not symlink include/lzma
/usr/local/include is not writable.
GMac:~ XXXX$ cmake
dyld: Library not loaded: /usr/local/lib/liblzma.5.dylib
Referenced from: /usr/local/bin/cmake
Reason: Incompatible library version: cmake requires version 8.0.0 or later, but liblzma.5.dylib provides version 6.0.0
Trace/BPT trap: 5
GMac:~ XXXX$ find / -name libzma.5.dylib 2>/dev/null
^C
GMac:~ XXXX$ find /usr -name libzma.5.dylib 2>/dev/null
GMac:~ XXXX$ find /usr -name libzma.5.dylib
find: /usr/sbin/authserver: Permission denied
GMac:~ XXXX$ sudo find /usr -name libzma.5.dylib
Password:
GMac:~ XXXX$ sudo find /usr -name libzma.5.dylib
GMac:~ XXXX$ find /usr -name libzma.5.dylib
find: /usr/sbin/authserver: Permission denied
GMac:~ XXXX$
GMac:~ XXXX$
GMac:~ XXXX$ sudo find /usr -name libzma.5.dylib
GMac:~ XXXX$ sudo find / -name libzma.5.dylib
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
liblzma^CGMac:~ XXXX$ sudo find / -name "libzma.5.dylib"
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
The error indicates you’re missing the dependency on liblzma, which in Homebrew is contained in the xz formula. Try this:
brew install xz
shareimprove this answer
answered May 16 '14 at 20:20
Buck Doyle
4,2651922
I needed to remove the older version rm -rf /usr/local/Cellar/xz/5.0.3 and brew link --force xz for Version 5.2.0 – daniel Feb 19 at 23:22