bash: /home/linuxbrew/.linuxbrew/bin/go: Bad address - go

I did an brew upgrade and afterwards keep getting an bad address error.
Tried to uninstall/reinstall everything, but cant figure out what is the problem.
bash: /home/linuxbrew/.linuxbrew/bin/go: Bad address
Im new to terminal and linux, so all advice is welcome.
I tried brew doctor. It says "No developer tools installed." and after i 'brew install gcc' it says gcc is already installed and up-to-date.

Use the official Go installation:
Go: Download and install
For full support, avoid OS package managers, Homebrew, and so forth.
First, remove any previous installations by other methods, for example, Homebrew.

Little late, but this post was a suggestion for me when I ran into a similar issue with Go and Brew.
When Brew updates the version of Go (1.19.3 -> 1.19.5 in my case) that it is providing, for some reason it does not correctly update the GOROOT environment varaible. Correcting the value of the variable fixed the issue for me.
export GOROOT=/home/linuxbrew/.linuxbrew/Cellar/go/<go_version>/libexec
# example
export GOROOT=/home/linuxbrew/.linuxbrew/Cellar/go/1.19.5/libexec

Related

Installing pyodbc and unixodbc on a mac

I've seen Pypyodbc: Can't open lib 'FreeTDS' : file not found") error when trying to connect to SQL server, but. that's 7 years old, and doesn't seem to be working for me, possibly because brew appears to be putting things in different places now?
I've used brew to install unixodbc, it's in /opt/homebrew/Cellar.
When I do pip install pyodbc, it appears to work, but I get:
connection = pyodbc.connect(connection_string)
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libtdsodbc.so' : file not found (0) (SQLDriverConnect)")
which is obviously wrong, because libtdsodbc is in /opt/homebrew/lib
I tried editing odbcinst.ini, but I'm not sure where that's supposed to live. There wasn't one in /etc, or a /etc/unixODBC directory... and when I create either one, the don't seem to be read, because it still complains about /usr/local/lib...
ETA: This is on a new Macbook, so on one of the new M1 chips.
Note: This is a BAD answer in the hopes of attracting a good one, but it technically seems to be working.
Homebrew for M1 installs everything in /opt/homebrew. Everything else expects things in /usr/local. On a new computer, /usr/local/lib didn't even exist. So I did
sudo ln -s /opt/homebrew/lib /usr/local/lib
THIS IS VERY BAD AND I KNOW IT But it's the only way I've figured out currently to deal with the problem. Maybe something hasn't caught up to M1? I'm not sure.
BETTER solution:
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/homebrew/lib
There is a pull request that has been pretty much ignored for 13 months now by the pyodbc maintainer: https://github.com/mkleehammer/pyodbc/pull/870
You can install the forked version with this command (might need to uninstall the previous version or add extra arguments to force reinstall)
python3 -m pip install git+git://github.com/Aloisius/pyodbc.git#m1-homebrew

How to change Homebrew's prefix?

I'm using MACOS M1, and started to install brew under ARM. Then at the other day, I installed some formula under x86.
When I run a command
brew doctor
And I got this message
Some of Homebrew's bottles (binary packages) can only be used with the default
prefix (/usr/local).
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
unsupported configuration.
How to change the prefix to /usr/local/?
When I run which -a brew I got this result
/opt/homebrew/bin/brew
/usr/local/bin/brew
Thanks in advance.
I had the same issue because I did not installed the homebrew from the local path on my terminal.
I just uninstalled the homebrew, installed it again (from the local path this time) and it is fine now.
To uninstall Homebrew, run the uninstall script from the HomeBrew/install repository.

GDL not found after installing with homebrew

I used brew install GDL. The install was completed, but once I try to use GDL, it says " command not found: gdl".
I used "which gdl", but still can't be located. I tried reinstalling GDL via brew, but same error.
I tried changing the directory to the folder where brew installed GDL, but no luck either.
I looked through my other compilers and those are saved into bin, while GDL is not (if that's relevant at this point).
Anything will help!
If the intention was to install GNU Data Language, please try installing gnudatalanguage from homebrew-science: https://github.com/brewsci/homebrew-science/blob/master/Formula/gnudatalanguage.rb

Problems with Cocoapods on Xcode 6.4

I'm trying to install and use Cocoapods with Xcode. I've installed already Brew, so I've used this command:
sudo gem install cocoapods
but it stays there, without response and without asking me for password (that's really strange, because of sudo command).
Maybe I got some problem with Brew Installation or Ruby on my Yosemite iMac?
I met the same error in the past, there is something wrong with my development environment. I re-install the Command Line Tools follow this guide, then everything is ok.
You can get the detail information from here, hope it can help you.

OSX Homebrew error: uninitialized constant MACOS

I've searched around a bit and can't seem to find any record of anyone else with this problem.
Whenever I try to run
$ brew update
I am rewarded with
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
This isn't my machine and I normally develop on Linux systems so this is all a bit odd to me.
Any help would be greatly appreciated! Please tell me if there is any additional info I should provide. Again, I'm not used to homebrew or OSX.
EDIT
at the request of JameA
xiao:~ patrick$ brew doctor
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
xiao:~ patrick$ brew --config
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
...Not sure I like this whole "here, use this macbook for the project, it works better" thing...
I'm pretty sure the root cause of this is a failed upgrade attempt to Homebrew 0.9.5 from a much earlier version. Basically, if you run brew update as opposed to sudo brew update a portion of files are updated, while others are not. Here's what worked for me:
Edit /usr/local/bin/brew (it's just a Ruby file, not a compiled binary, so any text editor will do). You'll find a block like:
if MACOS and MACOS_VERSION < 10.5
abort <<-EOABORT.undent
Homebrew requires Leopard or higher. For Tiger support, see:
https://github.com/mistydemeo/tigerbrew
EOABORT
end
Comment this out. Even if you don't know Ruby, you can probably intuit what this is doing—it's checking to see if you have a current version of OSX. Assuming that you do in fact have this version, this sanity check isn't necessary. Brew is still broken, but at least now it will load far enough to give error messages.
Run sudo brew update, spoiler alert: it fails, but this time with a meaningful error message:
$ brew update
error: Your local changes to the following files would be overwritten by merge:
[giant list of files here]
Well, today I learned that brew update is just a wrapper for git pull because anyone who has worked with git knows that error message. We can fix this too.
Switch into the homebrew git repository with cd /usr/local and give the command git reset --hard FETCH_HEAD.
This piece found here.
Give the command sudo brew update. Homebrew should now update successfully and work properly!
Once the system is working again, you can actually kind of see why an error like this would have occurred. For one, usr/local/bin/brew has been completely rewriten and isn't even Ruby anymore, and most of its configuration has been moved into /usr/local/Library/brew.rb which no longer uses the constants MACOS or MACOS_VERSION constants, as they have been replaced by the more object oriented OS.mac and MacOS.version.
The MACOS constant is set in globals.rb. It seems like you may have a borked installation of Homebrew.
Check the output of brew doctor for any suggestions.
If that doesn't help please update with the results of brew --config.
If all else fails you may want to try re-installing Homebrew.
UPDATE:
Since this was a previous user's machine make sure your user is the owner of /usr/local and everything within. Fix it with sudo chown -R $USER /usr/local.
I had a similar issue, when I Killed an install mid-way with Ctrl-D.
Post that whenever I tried installing anything it gave the following error
uninitialized constant Homebrew::CLI::Parser::ARGV_WITHOUT_MONKEY_PATCHING
As a fix, I went to the directory I had where homebrew was installed, and reset the HEAD.
cd /usr/local/Homebrew
git status
git checkout .
And then it started working magically.
I had a similar error with a "borked" installation of brew. I removed the small 5 line block of code in the /usr/local/bin/brew script starting with the MACOS line. That did the trick to allow me to uninstall and eventually reinstall it.
In addition to Matt Korostoff's answer.
On point 3 (resetting the repo), for recent version of Homebrew, the repo is no longer /usr/local, do cd "$(brew --repo)" instead.

Resources