I installed PIL and then I installed libjpeg and I get the following errors:
jpeg8-d is already installed, it's just not linked
Could not symlink file: /usr/local/Cellar/jpeg/8d/bin/wrjpgcom
Target /usr/local/bin/wrjpgcom already exists. You may need to delete it.
To force the link and delete this file, do:
brew link --overwrite formula_name
Both the problem and the solution are completely described by the error message you posted. What part of it do you not understand?
Could not symlink file: /usr/local/Cellar/jpeg/8d/bin/wrjpgcom
Target /usr/local/bin/wrjpgcom already exists.
This is telling you that, for some reason, you've got already got a /usr/local/bin/wrjpgcom from somewhere besides Homebrew, and Homebrew doesn't want to mess with it, in case you had a good reason for it.
To force the link and delete this file, do:
brew link --overwrite formula_name
If you have no idea where that file came from, don't care, and just want it to be blasted, just do brew link --overwrite jpeg8-d.
You probably also want to run brew doctor to have it look for other problems in your setup that you should fix.
Related
How do I specify a version number when installing something with brew cask install?
For recent versions of Homebrew, Jethro' instructions below may not work work, because we will get an error like:
Invalid usage: Non-checksummed download of <FORMULA_NAME> formula file from an arbitrary URL is unsupported.
I found a workaround:
Go to the Homebrew Cask search page: https://formulae.brew.sh/cask/
Type and find the application you are looking for
Click Cask code link
On Github click History button
Find the version you need by reading the commit messages and view the raw file. Confirm the version variable (normally on line 2) is the version you need.
Click on the name of the commit, then three dots and select View file
Right-click Raw button and Save Link As... to download the file locally
When downloaded, go to download directory cd Downloads/
Finally run brew install --cask <FORMULA_NAME>.rb
Voilà 😄
If you need some visual assistance check the screenshots here.
You can manually point brew at the ruby file for a specific version of a cask, using a git hash. This lets you control which version is installed.
For example:
Find the cask .rb file on the homebrew-cask git repo that you
want.
Get the commit hash, eg
cee7983cd95fc92fdc250fc509f2379cefe647fe in the example above.
Git may give you instructions to view the file history locally - eg git clone https://github.com/Homebrew/homebrew-cask.git git log master -- Casks/CASK_NAME.rb
Point brew at the file using the hash: brew cask install https://raw.githubusercontent.com/caskroom/homebrew-cask/cee7983cd95fc92fdc250fc509f2379cefe647fe/Casks/minikube.rb
The other answers are pretty heavy handed, an alternative is to use the homebrew/cask-versions tap which contains a list of the old (major) versions of casks.
To use them tap it with brew tap homebrew/cask-versions and then you can search for your cask again like brew search --cask yourformula and see if what you're looking for is there.
Or you can see the complete list of casks by clicking on Casks folder at https://github.com/Homebrew/homebrew-cask-versions .
If you run
brew edit [formula]
you can change the version that matches your operating system. If you know the checksum, enter that too. If not, just comment that line out with # and it will skip the check. Then run
HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall [formula]
Please help understand what is going on--or whether any action is required. I've gone through a lot of posts on dealing with brew, node, symlink, uninstalled and reinstalled node, npm, yarn, tried brew cleanup. When brew doctor produced these warnings--
Warning: Broken symlinks were found. Remove them with `brew prune`:
/usr/local/lib/node_modules/npm/node_modules/.bin/JSONStream
/usr/local/lib/node_modules/npm/node_modules/.bin/errno
/usr/local/lib/node_modules/npm/node_modules/.bin/is-ci
/usr/local/lib/node_modules/npm/node_modules/.bin/node-gyp
/usr/local/lib/node_modules/npm/node_modules/.bin/opener
/usr/local/lib/node_modules/npm/node_modules/.bin/qrcode-terminal
/usr/local/lib/node_modules/npm/node_modules/.bin/rc
/usr/local/lib/node_modules/npm/node_modules/.bin/semver
/usr/local/lib/node_modules/npm/node_modules/.bin/sshpk-conv
/usr/local/lib/node_modules/npm/node_modules/.bin/sshpk-sign
/usr/local/lib/node_modules/npm/node_modules/.bin/sshpk-verify
/usr/local/lib/node_modules/npm/node_modules/.bin/uuid
/usr/local/lib/node_modules/npm/node_modules/.bin/which
When I tried brew prune, I got:
newmbp$ brew link node
Warning: Already linked: /usr/local/Cellar/node/10.11.0
I noticed the files (to be linked or unlinked) are in separate folders, but have been struggling to understand the implications of having files in /usr/local/Cellar vs in /usr/local/lib
The precipitating factor that led to all of this was the fan on my laptop runs furiously from time to time, often while MAMP is running.
brew cleanup --prune-prefix (ex- brew prune) removed the broken symlinks, so the issue should be gone.
The fact that brew link node complains has nothing to do with this; it’s a completely different command. It’s not even an error, just a warning: "you asked me to link node but it’s already linked" so everything’s fine here.
Homebrew installs its files in /usr/local/Cellar. On the other hand, /usr/local/lib is a shared directory commonly used for libraries. In order for software to find libs Homebrew installed, it symlinks them in it.
For example, let’s say you have a formula foo version 1.2.3 that installs a library bar. After running brew install foo you should get something like this:
# the library files
/usr/local/Cellar/foo/1.2.3/lib/bar
# a symlink to the library files from /usr/local/lib
/usr/local/lib/bar -> /usr/local/Cellar/foo/1.2.3/lib/bar
If you brew uninstall foo, it removes both the library files and the symlink.
Those Homebrew symlinks can be manipulated with brew unlink <formula> (remove them) and brew link <formula> (add them). brew install runs brew link for you so you don’t need to. This is the reason why you get a warning: your Node symlinks already exist.
brew doctor performs various checks, including check_for_broken_symlinks. This one looks into directories such as /usr/local/var or /usr/local/lib for broken symlinks. A broken symlink is a symlink whose target doesn’t exist, often because it has been removed.
The important point to understand here is that Homebrew looks at all symlinks, not just the ones it created. Broken symlinks may cause issues, which is why Homebrew warns you about them, but if everything’s working fine for you feel free to ignore the warning.
I am working on a formula to brew install postfix from source code in the my mac mini. I am able to make the makefiles, make, and make install the software, however brew link can not be completed due to the libdns.a needed to be linked into /usr/local/lib. There is a link in the directory with the same name from bind already installed previously. So, I need to ask for help to resolve the conflict.
Is there any workaround to relocate the link to /usr/local/lib/postfix, /usr/lib, or somewhere else?
Can I ignore the very link and just complete the rest? What will fail?
Is there a way to to recompile from an edited source code via homebrew?
I did a change on the source user.hpp of Boost which I now want to recompile Boost with. I tried --build-from-source and --enable-bar but neither works, saying that it is already installed. The only way I can recompile is by reinstall but that simply overwrites the source code I changed.
Any idea?
First option
Download the archive, edit the files, and zip the archive as homebrew does (same name and format).
If you kept the original folder structure created by Homebrew, you can put the modified archive in ~/Library/Caches/Homebrew and then try brew install -f. (the -f is maybe not strictly necessary but it may be need for the SHA-1 mismatch.)
More info on this blog.
Second option
Pulled out from the Homebrew wiki, install the package without homebrew and then link it with brew.
./configure --prefix=/usr/local/Cellar/foo/1.2 && make && make install && brew link foo
Another approach is to add a patch to the homebrew formula (you can edit the formula using brew edit <formula-name>):
https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md#patches
So I've been using homebrew to install various packages/libraries/programs on my mac. I keep running into a problem in which homebrew tells me that I have unlinked kegs in my Cellar.
For instance, upon running brew install phantomjs I received the following message:
Warning: Could not link phantomjs. 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 phantomjs'
Possible conflicting files are:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs
I tried running brew link phantomjs as recommended, and hit a similar problem:
Error: Could not symlink file: /usr/local/Cellar/phantomjs/1.9.2/bin/phantomjs
Target /usr/local/bin/phantomjs already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
brew link --overwrite formula_name
The command brew link --overwrite --dry-run phantomjs gives the following message:
Would remove:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs
I will probably go ahead and overwrite, but this appears to happen every time I try to install something with homebrew. Why? Why isn't homebrew working as expected?
Thanks.
From what I can tell, looks like you have previously done:
% sudo npm install -g phantomjs
In this case, you should do the following:
% sudo npm uninstall -g phantomjs
% brew link --overwrite phantomjs
I thought I'd take a crack at this. I ran into a similar problem today, and I think it may be related to this:
https://github.com/Homebrew/homebrew/issues/22408
Long story short, I think it has to do with how npm manages packages vs how brew does it. (I'm assuming you installed node with its defaults, which would have given you npm).
At some point you probably installed some package with npm. Maybe grunt, karma, etc..those by default end up in /usr/local/lib/node_modules.
Maybe one of those packages or its dependencies(or sub-dependencies) depended on phantomjs (I think Karma might use phantomjs?) Anyways, if now you are trying to brew install phantomjs, which is trying to make a symlink to it, that may be conflicting with the already existing symlink that npm created for you..
I think you can change the symlink path for that package so that brew permanently points to that already installed package in the node_modules folder. Sorry not to be more specific, I'm just figuring this out myself.