linuxbrew/lib/ld.so: bad ELF interpreter: No such file or directory - bash

I am having a problem about linuxbrew.
bash: /lustre7/home/lustre4/user1/applications/bin/cut: /lustre7/home/lustre4/user1/.linuxbrew/lib/ld.so: bad ELF interpreter: No such file or directory
I tried to uninstall linuxbrew using instructions at its website, but somehow it didn't work (because of sudo requirements).
there is linuxbrew directory but I can't remove when I type rm -r linuxbrew it says;
-bash: /lustre7/home/lustre4/user1/applications/bin/rm: /lustre7/home/lustre4/user1/.linuxbrew/lib/ld.so: bad ELF interpreter: No such file or directory
When I tried to install homebrew it says your CPU is not supported. (I tried this before and it worked, but now it is not working.)
I want to solve this problem but I couldn't find any solution. I am not able to run sudo and yum commands because I am not root. I am a user at a linux cluster.

OK. I finally was able to solve this issue.
I am wring in case someone else may have the same issue.
First, this was related to a bash problem. I recently installed a tool that put some variables to both bashrc and bash_profile and altered path of bin directory.
I wasn't able to use system commands such as rm, ls, cat etc. and I wasn't able to run system ruby. Paths of all commands and ruby were in my bin directory under my application directory.
What I did is;
I edited my bash_profile by cancelling the new path that caused conflict between bash_profile and bashrc. This enabled me run system commands.
I uninstalled linuxbrew as described in its website.
I removed linuxbrew from my home directory, and cancelled its path in bash_profile (comment out).
I installed homebrew again and put its path to my bashrc.
Now it is working.

I could uninstall linuxbrew using the procedure I described in here:
How to completely uninstall brew and re-install brew in ubuntu 19.04
-> In short, I just replaced install.sh by uninstall.sh and it worked...
$/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

Related

Why doesn't shell scripts in Shortcuts see my utilities?

i tried using shortcuts. i wanted to run scripts there, but i constantly get an error that the brew utility was not found. it feels like the scripts run in isolation.
i tried use
brew link php
eval 'brew link php'
sh fileWithMyScript.sh
and always got error. how to fix it?
The brew command is not in macOS default PATH. You will either have to use the full path to the command or set PATH before calling the command:
/opt/homebrew/bin/brew link php
PATH=$PATH:/opt/homebrew/bin brew link php
PATH=$PATH:/opt/homebrew/bin cd ~/utils && sh php_8.1.sh
Use a different directory than /opt/homebrew/bin if homebrew is installed elsewhere.

Mac OSX (Apple Silicon) Homebrew installed but brew cmd not found

I have googled around the error I was experiencing but from what I could tell this issue is likely related to how the path in which Homebrew is saved for Big Sur/Apple Silicon is different than other Macbook approaches.
Following the instructions on the Homebrew page, I ran the cURL command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
However, after the operation successfully completed, there was a warning in terminal:
warning: bin/opt/ path does not exist
And when I attempted to run a brew doctor the command was not found.
It's clear there is a pathing issue, but how do I solve it
In this case, I discovered it was a combination of a PATH issue as well as the .zshrc file was missing from the ~/ directory
I was able to resolve the issue with these steps.
Navigate to cd /opt/homebrew/bin/
Run export PATH=$PATH:/opt/homebrew/bin
Navigate back to "home" with cd ~/
in this directory I found that there was no .zshrc file (:scream:)
So I created a file with touch .zshrc and then
ran this command: echo export PATH=$PATH:/opt/homebrew/bin >> .zshrc
And after running that command, I was able to successfully use the brew doctor and other related commands!

"You don't have [PATH ]in your PATH, gem executables will not run." while using "gem install --user-install bundler"

I was trying to install jekyll in my Mac and got the warning as following:
WARNING: You don't have /Users/Carrot/.gem/ruby/2.3.0/bin in
your PATH, gem executables will not run.
I checked through gem list and it shows it is installed; and I can find the jekyll through the path "/Users/Carrot/.gem/ruby/2.3.0/bin". I read a post which seems like my situation. I would like to know if it's a must to go through sudo? I now prefer to uninstall everything (since it also installed sass and bunch of things at the same time) and go through homebrew. How can I do the uninstallation?
Many thanks!
For those who have problems with #lamech-desai answer, (actually, when they do Desai's commands, it apparently works temporarily for them).
So you can easily do these:
open ~/.bshrc if you would like to use bash or ~/.zshrc if your are using zsh or etc...
$ sudo nano .bashrc ## bash users
$ sudo nano .zshrc ## zsh users
then copy and past these two lines of code at the end of the .*rc file:
export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
export PATH="$PATH:$GEM_HOME/bin"
then simply press ctrl+s and ctrl+x. This will save the changes to .bashrc but you won't see them immediately - directly on your next shell login with your current user. One way to see the changes immediately is to switch user to root with su root and then switch back to your previous user with su <username> - and voila, your .bashrc will be reloaded. You can also check this with echo $PATH.
Thanks to #lamech-desai for great answer
If you are using arch linux just use the commands below in your terminal
[user~]$ export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
[user~]$ export PATH="$PATH:$GEM_HOME/bin"
[user~]$ gem list
[user~]$ gem update
You need to add the directory to your PATH environment variable
https://askubuntu.com/questions/406643/warning-you-dont-have-a-directory-in-your-path-gem-executables-will-not-run
If you are on a Mac like me, you need to add the PATH to the PATH environmental variable. You can do it with export command:
export PATH="/Users/Carrot/.gem/ruby/2.3.0/bin:$PATH"
If you wanna know more about this process, here is a blog post about this: Adding a Path to the Linux PATH Variable
Probably a bit odd to answer my own question but I did finally fix it somehow like a blind fly. I hope to write down the experience maybe who else is totally like me as a absolute beginner with everything wouldn't get struggling overnight.
Stage 1: from gem to homebrew (failed)
At the beginning, I did remove items that install in gem item-by-item, then I install brew-gem to do it. At some stage, it work for jekyll but not my theme. It kept popping out I didn't install a package that the theme needs even I installed it manually. So in the end, I remove everything related to jekyll from homebrew.
Stage 2: back to gem (very long path but finally made it)
I later found a page tell step-by-step to install jekyll. I am using OSX 10.13 (High Sierra) that cause me the permission problem. So I just granted access with this line:
sudo chown -R $(whoami) /usr/local/*
The * is a must or it won't work. I did the same to the ruby part
sudo chown -R $(whoami) /Library/Ruby/Gems/2.3.0/*
After that I install jekyll and bundler carefully following the instruction. And install the packages that the theme needs manually through gem install, which you can find at the Gemfile. I got the problem of jekyll-sitemap similar as this, I followed the method to install pygment.rb through gem install pygments.rb. And now my site is locally work.

vagrant: command not found after install on Mac OSX 10.10.4

Downloaded Vagrant, and went through th installation process.
When I ran vagrant -v it says vagrant: command not found
It has put the files in /opt/vagrant/...
It should install in the Applications folder with a link to the /usr/bin so it is added to the shell path.
There is no directory that has been created during this process.
I am afraid I can't even get started with it. ITs obviously not creating all the shortcuts it needs to be able to run the commands.
I have looked for support on this issue and reported a bug.
I also accepted the xcode licence agreement.
Has anybody else had this issue.
My next step is to manually create the shortcuts.
If you look at the uninstall script including in the Vagrant DMG, it is referring to /usr/local/bin which does not exist. It should be error handling (the Vagrant pkg installer) and create it (permissions/ownership etc) but it doesn't.
You need to mkdir the /usr/local/bin. I tried a symlink between /usr/bin/vagrant (as /usr/bin exists, and in-path) to /opt/vagrant/bin/vagrant BUT this does not work, as later on in life, Vagrant refers in a hard fashion to /usr/local/bin/vagrant because its stupid.
$ sudo mkdir /usr/local/bin
If you sudo it, it should be made with correct ownership etc. Now just re-run the Vagrant installer pkg.
Make sure the Virtual Box setup is installed on Mac before installing Vagrant.
I raised the bug with https://github.com/mitchellh/vagrant/issues/6034
The issue is that I had no /usr/local directory at all.
It is an apple issue.
After I created the directories as you described I was able to install vagrant vitrual boax and laravel.
Here is what I did.
sudo mkdir /usr/local
Then bin.
cd /usr/local
sudo mkdir bin
I uninstalled Vagrant, re-installed and when I ran vagrant -v I then got the version.
cd /usr/local/bin
ls
sudo chmod 755 vagrant
Thanks for your Answer.
Weird, on 1.8.5 I couldn't run Vagrant either, noticed that /usr/local/bin was owned by root. Ran command
# chown -R User:Group /usr/local/bin
as root and works from my username now.

MongoDB installed via Homebrew not working

I installed MongoDB via Homebrew (following http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/) but it's not working.
Typing mongod at shell prompt gives me:
-bash: mongod: command not found
Not sure if I need to add something for Homebrew to my PATH env var?
I can see Mongo is installed under /usr/local/Cellar/mongodb – but am assuming I don't need to add everything I install via homebrew to the path? Also, assuming I can run mongod from any directory or am I actually meant to be in install directory?
When I run brew doctor I get:
Warning: You have unlinked kegs in your Cellar
Followed by a list of 3 items which includes MongoDB – but I'm not sure how I'm meant to link them?
Works perfectly
brew update
brew tap mongodb/brew
brew install mongodb-community#4.2
For latest version, check https://docs.mongodb.com/manual/release-notes/
You're getting this error because your 'brew' install failed to create the correct symlinks in /usr/local/bin. As a result, the shell can't find the mongo executables in your $PATH. You can fix this using the following steps:
Check the permissions on /usr/local/bin and make sure that you own that directory and have write permissions on it
$ ls -ld /usr/local/bin
Once you've fixed that, run 'brew link' to fix the symlinks
$ brew link mongodb
If you are on mongodb-community#4.0. You can try to reinstall with brew reinstall mongodb-community#4.0.
Then I get the following hint:
==> Caveats
mongodb-community#4.0 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have mongodb-community#4.0 first in your PATH run:
echo 'export PATH="/usr/local/opt/mongodb-community#4.0/bin:$PATH"' >> ~/.bash_profile
So you can just copy the echo command and restart your shell!
Copied from a different channel running these commands in the terminal updated the installation/configuration issues as described in OP
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
I faced the same problem and this solution seemed to work for me. I had previously uninstalled mongodb and reinstalled it through homebrew which gave me a bunch of problems. This solution seemed to work just fine.
brew uninstall --force mongodb
brew cleanup -s mongodb
brew cleanup --prune-prefix
brew install mongodb
It works from the directory since the sh searches the ENV path and then the cwd for a program named mongod. I have been looking around a little and it seems that the default install of MongoDB (I am not a Mac user) does not install a rc or init script for which sh to understand it's running behaviour as stated here:
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/#using-mongodb-from-homebrew-and-macports
The packages installed with Homebrew and MacPorts contain no control
scripts or interaction with the system’s process manager.
If you have configured Homebrew and MacPorts correctly, including
setting your PATH, the MongoDB applications and utilities will be
accessible from the system shell. Start the mongod process in a
terminal (for testing or development) or using a process management
tool.
So you must actually define (as you said) MongoDBs path, here is an example: https://snipt.net/sido/installing-mongodb-on-os-x/
Edit: the example is not mine. I just stole it from it's user: https://snipt.net/sido/

Resources