How do I remove a broken terminal command in OSX? - bash

I installed protobuf 2.5 using homebrew but wanted to upgrade to the latest version. I ran brew uninstall protobuf#2.5 and then brew install protobuf.
However now when I run the protoc command I get the error:
-bash: /usr/local/opt/protobuf#2.5/bin/protoc: No such file or directory
I tried running brew unlink protoc && brew link protoc but the error still persists. How do I go about removing the association of protoc with the deleted directory?

Looks like you’ve installed a newer version of protobuf, but your symlinks are still pointing to the old version. Clean up again:
brew uninstall protobuf#2.5
brew unistall protobuf
brew unlink protobuf
At this point, which protobuf should return empty. If it returns a file or link, remove that manually, then brew install again.
Hope this helps.

Related

-bash: protoc: command not found

I am using my mac Version :OSX El Capital 10.11.6
I tried this command
protoc --version
its not working
and I did this steps :
1. brew uninstall --devel protobuf
2. brew link libtool
3. brew install --devel protobuf
and not working is there any other method?
Try to do:
brew link --force --overwrite protobuf
and then check --version again,
It might because brew didn't make symbolic link of protoc
it works to me

No such keg: /usr/local/Cellar/git

I have been struggling with this for a few hours. I am on a Mac using Yosemite. I had homebrew installed, and was using git just fine. I tried doing $git add -i and I got this error:
Can't locate Git.pm in #INC (#INC contains:
So I followed the instructions here:
Can't locate Git.pm in #INC
$brew uninstall git worked fine, but after I tried to $brew install git I've been stuck in a terrible cycle.
% brew install git
Error: git-git already installed
To install this version, first `brew unlink git'
% brew unlink git
Error: No such keg: /usr/local/Cellar/git
% brew link git
Error: No such keg: /usr/local/Cellar/git
% git --version
git version 1.9.3 (Apple Git-50)
% brew upgrade git
==> Upgrading 1 outdated package, with result:
git 2.2.2
Error: /usr/local/Library/LinkedKegs/git is not a valid keg
% brew install git
Error: git-git already installed
To install this version, first `brew unlink git'
%
I just want to get homebrew & git back to normal and linked to the correct repo again. I'm really rough around the edges at this stuff, so any help would be greatly appreciated!
Give another go at force removing the brewed version of git
brew uninstall --force git
Then cleanup any older versions and clear the brew cache
brew cleanup -s git
Remove any dead symlinks
brew cleanup --prune-prefix
Then try reinstalling git
brew install git
If that doesn't work, I'd remove that installation of Homebrew altogether and reinstall it. If you haven't placed anything else in your brew --prefix directory (/usr/local by default), you can simply rm -rf $(brew --prefix). Otherwise the Homebrew wiki recommends using a script at https://gist.github.com/mxcl/1173223#file-uninstall_homebrew-sh
Had a similar issue while installing "Lua" in OS X using homebrew. I guess it could be useful for other users facing similar issue in homebrew.
On running the command:
$ brew install lua
The command returned an error:
Error: /usr/local/opt/lua is not a valid keg
(in general the error can be of /usr/local/opt/ is not a valid keg
FIXED it by deleting the file/directory it is referring to, i.e., deleting the "/usr/local/opt/lua" file.
root-user # rm -rf /usr/local/opt/lua
And then running the brew install command returned success.
Os X Mojave 10.14 has:
Error: The Command Line Tools header package must be installed on
Mojave.
Solution. Go to
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
location and install the package manually. And brew will start working and we can run:
brew uninstall --force git
brew cleanup -s git
brew cleanup --prune-prefix
brew install git

brew link php55 does not work

I tried to install php55 which works fine itself, but the linking does not work. Which means I cannot install any modules via brew.
$ brew link php55
Linking /usr/local/Cellar/php55/5.5.17... Error: No such file or directory - /usr/local/Cellar/php55/5.5.16/include/php
Brew tries to link 5.5.16 but it should use 5.5.17. I already reinstall php55 again a few times and used "brew cleanup" in between.
How can I link it correctly?
Remove it with "brew remove php55". It will automatically look at the other version afterwards. Don't forget to relink it with "brew unlink php55 && brew link php55".

SVN using wrong sqlite version

when running my svn from /usr/local/bin/ it says:
svn: E200029: Couldn't perform atomic initialization
svn: E200030: SQLite compiled for 3.7.13, but running with 3.6.12
sqlite3 --version gives me 3.7.13
What went wrong and how can I fix it?
I'm on Mac OS X (10.6.8).
//edit1:
/usr/local/bin/sqlite3 --version 3.7.13
/usr/bin/sqlite3 --version 3.7.13
//edit2: I "fixed" this by installing svn via homebrew and using /usr/local/bin/svn explicitly
Let me sum up the fixes and suggestion from the answers below:
(please upvote the corresponding answer)
For Mac users:
(re-)install svn via homebrew or whatever you use (you may need to brew link --force sqlite3)
For Fedora users:
try yum update sqlite3 or yum install sqlite
I experienced the same issue, I solved downloading http://www.sqlite.org/sqlite-amalgamation-3.7.6.3.tar.gz, unpacking the archive using tar/gunzip and coping sqlite3.c from the resulting directory into $svn-src-folder/sqlite-amalgamation/sqlite3.c.
Run configure/make/sudo make install and you should solve.
I had brew, svn 1.8, working fine in OSX 10.8.
I upgraded to 10.9, broke. For some reason the symlinks brew makes in /usr/local/bin were removed by the 10.9 installation?
brew update didnt fix.
brew install svn fixed svn, or so I thought.
Then actually using svn 1.8 (/usr/local/bin first in my path) I also had the above sqlite error message. A newer sqlite being in /usr/local/Cellar, but not symlinked in /usr/local/bin or anything.
brew install sqlite3 ... didnt fix it. And I noticed brew says for this component it doesnt symlink. ok.
BUT, after that reinstall, a further reinstall of svn
brew svn uninstall
brew svn install
DID fix it. dont know why. Now can svn co successfully.
After re-linking subversion, I had also to re-link sqlite3
brew link --force sqlite3
It means subversion was compiled with SQLite version 3.7.13, but now you are running SQLite 3.6.12.
All you need to do is recompile/reinstall your subversion again.
update sqlite3!!
I had similar issue on Fedora Core 20
Did the following:
yum update sqlite3
For me, yum install sqlite in fedora fixed the problem.

Lion (10.7) Not supporting Convert(1). Dylib error

When trying to use convert(1), I get the following error:
dyld: Library not loaded: /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libclparser.dylib
Referenced from: /usr/local/bin/convert
Reason: image not found
Trace/BPT trap: 5
Any idea how I could fix it ?
I was getting this error as well–with a homebrew install of ImageMagick. Along the same lines as Pascal, I fixed it with
Install XCode 4.1 (from the App Store)
In Xcode, go to Xcode > Preferences... > Downloads tab > click Install next to Command Line Tools
Uninstall ImageMagick with brew uninstall imagemagick
Update homebrew with brew update
Install latest homebrew with brew install imagemagick
Run brew doctor and delete any of the *.la and *.a files listed if step 4 fails on make install
I got the same error and what solved the problem for me was:
Install the latest XCode version from the Mac Appstore
Install ImageMagick using Macports (sudo port install imagemagick)
Both steps took a while, but in the end ImageMagick worked fine again.
I installed xcode but had some issue with macports. Bummer!
I copied the libclparser.dylib file over from an old backup of 10.6, changed the permissions to match the other files in that folder and it worked!
Also see here:
https://stackoverflow.com/questions/6674666/installing-imagemagick-leads-to-weird-error-involving-opencl
Edit:
I found this, which may be useful: http://cactuslab.com/imagemagick/
Also, the file is here: http://www.workdreamer.com/uploads/libclparser.dylib
Reinstalling it even with brew instead of macports didn't work for me. Copying it did.
Try the following command:
brew doctor
to diagnose the common problems.
One of it could be removing DYLD_FALLBACK_LIBRARY_PATH variable from your ~/.profile
Or you have to re-install libtool by:
brew reinstall libtool --universal && brew unlink libtool && brew link libtool

Resources