Problem installing git subrepo on MacOs bash 5 - bash

I was trying to install git subrepo on MacOs with bash 5.0.18 installed. When I source .bashrc, I get error message :
The git-subrepo command requires that 'Bash 4+' is installed. It
doesn't need to be your shell, but it must be in your PATH. You appear
to be on macOS. Try: 'brew install bash'. This will not change your
user shell, it just installs 'Bash 5.x'.
Is git subrepo not compatible with bash 5 or is there any solution to make it work?
https://github.com/ingydotnet/git-subrepo

apparently, I can install it using brew with less hassle:
brew install git-subrepo

It should be a PATH issue, as illustrated by ingydotnet/git-subrepo issue 463
I realized there was a part of my path not being specified which caused this issue.

Related

"pre-commit" command is not found by bash but is installed on macOS

Problem Description
I'm having trouble making commits, when I try to make a commit with the command, for example:
$ git commit -m "add readme"
pre-commit not found. Install pre-commit with the command pip3 install --user pre-commit or follow the steps on official documentation: https://pre-commit.com /#install
Following the steps described in the pre-commit installation documentation I installed by the command:
$ pip install pre-commit
However when I trigger the command the following error occurs:
$ pre-commit --version
bash: pre-commit: command not found
My attempt fails
I've tried some other solutions for this but they didn't work:
Export bash
I already tried this solution described that would be to export my ~./bashrc with the command: source ~/.profile but the following error happens:
bash:/Users/pvieira/.profile: No such file or directory
Install using homebrew
Doing so the same error that occurs when installing by pip appears here.
I was able to solve the problem by simply restarting the terminal.
I solved this problem by restarting my ubuntu system

Issues while trying to run git uninstall.sh on Mac OS

I wanted to try to update Git on my Mac OS to the latest version and it says to run the provided uninstall.sh first. I must confess that I ran the pkg before reading the "Read me". Not sure if that screwed it all up ...
Now I am not big with the terminal and found the following command to run a shell script:
$ sh uninstall
but that resulted in:
/usr/sbin/uninstall: /usr/sbin/uninstall: cannot execute binary file
where I got stuck now.
Any idea what I have to do to resolve this error?
You should run the uninstall.sh packaged with your previous distribution of Git, as explained in "Install and Update to latest version Git on Mac OSX 10.10 Yosemite":
Upgrading Git from a previous version to the latest 2.0.1
If you have previously installed Git you can upgrade to the latest version by uninstalling the previous install using the uninstall.sh file with the installation.
Go through the same process of downloading and mounting and the .dmg – then launch the Terminal.
uninstall and uninstall.sh are two different things. The former is a binary that comes with the os, the latter is a shell script that comes with the package.
Try: sh uninstall.sh instead

How do I update zsh to the latest version?

I recently switched to zsh on my Terminal.app on my OS X machine successfully. The version number of zsh is 4.3.11.
If you're using oh-my-zsh
Type omz update in the terminal
Note: upgrade_oh_my_zsh is deprecated
If you have Homebrew installed, you can do this.
# check the zsh info
brew info zsh
# install zsh
brew install --without-etcdir zsh
# add shell path
sudo vim /etc/shells
# add the following line into the very end of the file(/etc/shells)
/usr/local/bin/zsh
# change default shell
chsh -s /usr/local/bin/zsh
If you're not using Homebrew, this is what I just did on MAC OS X Lion (10.7.5):
Get the latest version of the ZSH sourcecode
Untar the download into its own directory then install: ./configure && make && make test && sudo make install
This installs the the zsh binary at /usr/local/bin/zsh.
You can now use the shell by loading up a new terminal and executing the binary directly, but you'll want to make it your default shell...
To make it your default shell you must first edit /etc/shells and add the new path. Then you can either run chsh -s /usr/local/bin/zsh or go to System Preferences > Users & Groups > right click your user > Advanced Options... > and then change "Login shell".
Load up a terminal and check you're now in the correct version with echo $ZSH_VERSION. (I wasn't at first, and it took me a while to figure out I'd configured iTerm to use a specific shell instead of the system default).
As far as I'm aware, you've got three options to install zsh on Mac OS X:
Pre-built binary. The only one I know of is the one that ships with OS X; this is probably what you're running now.
Use a package system (Ports, Homebrew).
Install from source. Last time I did this it wasn't too difficult (./configure, make, make install).
A simple script or execute following commands in terminal
# 1. download (currently the latest version is 5.8) and extract
wget https://sourceforge.net/projects/zsh/files/latest/download -O ./zsh-latest.tar.xz
mkdir zsh-latest
tar -xf zsh-latest.tar.xz -C zsh-latest --strip-components=1
cd zsh-latest
# 2. config, build, install
./configure
make -j4
sudo make install
which zsh
PS: If you fail to build, it probably due to missing necessary libraries. Just install libraries as the error message suggests. E.g, I didn't have ncurses:
sudo apt install ncurses-devel # for Ubuntu
sudo yum install ncurses-devel # for CentOS/Redhat
omz update gave me following error:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
This is an issue with git, where after upgrading to Mac OS Ventura (13.0.1). git command gave me above error.
Solution:
Download and install the 'Command Line Tools' package to fix 'git'
xcode-select --install
This will pop a dialogue box. Select "Install".
More details here: https://apple.stackexchange.com/a/254381
omz update worked successfully after this for me
I just switched the main shell to zsh. It suppresses the warnings and it isn't too complicated.

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/

New Ruby user trouble installing RVM

Before I start, let me say that I looked at all the similar questions and it appears that no one had this particular problem:
I installed git.
Next I ran this from the command line:
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
My result is
bash: line 151: git: command not found
bash: line 153: git: command not found
ERROR: Unable to clone the RVM repository, attempted both git:// and https://
What did I do wrong here? I am attempting to install this on osx Lion.
Additionally, can someone explain to me what the beginning of the bash command does? bash < <(...)
Just for my own curiosity :)
Thanks!
You need to have git installed first. The command executes the script downloaded with curl from the given url using bash. The <(...) is apparently used to provide a list of commands as per http://tldp.org/LDP/abs/html/process-sub.html.
You either installed git wrong, or it's not in your path. Have you installed XCode? It should automatically install git 1.7.4 and put it in your path. You'll also need to have XCode installed to be able to compile any ruby versions using RVM.

Resources