MinGW where is "cat" and "ls"? Simple commands are missing - windows

Performed a fresh install of mingw. here's exactly what i did:
mingw-get-setup.exe
installed to i:\mingw
using the GUI selected the following packages:
mingw-developer-toolkit
mingw-gcc-g++
msys-base
setup fstab:
i:
cd \mingw\msys\1.0\etc
copy fstab.sample fstab
change c:/mingw to i:\mingw
comment out perl
add to PATH:
i:\mingw\bin;i:\mingw\msys\1.0\bin
various things work, but there's no "cat" nor "ls". Looking inside i:\mingw these files just aren't there.
tried the shell:
i:\MinGW\msys\1.0\msys.bat
eg which gcc gives:
$ which gcc
/bin/which: line 47: ls: command not found
/bin/which: line 47: ls: command not found
/mingw/bin/gcc
any idea what package is missing.
thanks.

I had to set path=%path%;c:\MinGW\msys\1.0\bin\

turned out the file, coreutils-5.97-3-msys-1.0.13-bin.tar.lzma was corrupt.
Looks like the mingw-get does not check for errors when it downloads. :-(

Related

Error on terminal open: -bash: /nvm.sh: No such file or directory

Every time I open my terminal the first line says: -bash: /nvm.sh: No such file or directory.
I just installed nvm on this laptop and obviously I did something wrong.
Does anyone know what commands I can use to fix this?
I tried the following command to remove nvm from my laptop:
$ rm -rf ~/.nvm
Sadly, this did not fix my problem.
Check your .bashrc file (usually in the home folder). See answers to this question. There's probably a line reading /nvm.sh somewhere in there -- if so, just delete it.
As Gasper Stukelj awnsered:
There was a line reading /nvm.sh.
The correct path to the file was for me using macOS Mojave:
$ open ~/.bash_profile
In my case I fixed this problem, just putting in terminal, after installing nvm: export NVM_DIR="$HOME/.nvm" and [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
and after that I installed node normally
How did I find this solution?
Simple, I read the terminal, and it gave two ways to solve. The first option was for me to restart the computer, to see if the changes (installation) took effect, and the second option was for me to put these two commands in the terminal and only : )
Ready to use in my case :)
I used Google Translate
For me the issue was coming from the .bash_profile file. The line was:
source ~/.nvm/nvm.shexport PATH="/usr/local/opt/php#7.0/bin:$PATH"
I removed everything after nvm.she and the error isn't showing in the terminal anymore. This happened while trying to install xdebug on Mac Big Sur.
I failed to find a solution in Google searches, so I just installed nvm again to resolve the issue. I guess some files were not installed.
brew install nvm

Can I get the locate to work on Windows through Git Bash?

Git Bash seems to have nice support of various Linux commands. It even supports locate, though it never finds anything:
mypc#mypc MINGW64 ~
$ locate --regex .*?\/[^\/]+\.docx
I tried to update the locate database, but the support is not finished there:
mypc#mypc MINGW64 ~
$ updatedb
/usr/bin/updatedb: line 323: /usr/var/locatedb.n: No such file or directory
Failed to generate /usr/var/locatedb.n
Can I fix that by editing some script? What causes this problem?
from git bash run:
mkdir /c/Program\ Files/Git/usr/var; updatedb --localpaths='/c/'
Also you can add the following alias in your ~/.bash_profile:
alias updatedb="updatedb --localpaths='/c/'"
I havent tried the alias out yet bit I don't see why it would work.
Just make sure to either
source ~/.bash_profile
or open a new shell after you have added the alias so it gets loaded.
Thanks for the tip!
Just wanted to add to #danielpflood's answer, that I needed to run "Git Bash" as administrator, to be able to create the needed /var/ directory.
This is on Windows 10.
[wanted to add as a comment, but I do not have enough reputation for that.]
I found I needed to create a directory C:\Program Files\Git\usr\var and give my user full access to it.
This fixed the permissions issue, but in order to get it to index the correct files I also had to invoke updatedb as updatedb --localpaths='/c/' (I imagine this can be put in a config file somewhere)

mac command line command not found

Ok so I've been trying to run some things from the command line and I'm having a 'permission denied' problem and then when I 'sudo ./(file.c' I get a 'command not found'. It's weird because other .c files in the same directory work ok.
I've downloaded and installed Xcode and command line tools. Also, I have #include some other things that are also in the same directory.
When I echo $PATH I'm getting this output:
/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Thanks for any help that could be provided!
You're running sudo ./file.c but file.c looks like the name of a source code file which would usually not be executable. Probably the problem you're having is that you're trying to run something which cannot be run. If you really want to force the computer to run it, you can do chmod +x file.c before trying to run it. But if it is indeed C source code, it won't do anything useful.

Torch / Lua after installation is not working

I have followed the following approach in order to install Torch in my machine (Mac).
http://torch.ch/docs/getting-started.html#_
When I am done with the installation, I type:
$ luarocks install image
or $ luarocks lis
or $th
in order to load the th or to make updates on the lua packages. It says "command not found". Do you have any idea how I can resolve this issue?
If you're on a Mac using the bash terminal, make sure that you've permanently added /Users/you/torch/install/bin to your PATH.
To do this:
Navigate in your terminal to the root directory by running the command:
$ cd
Using the text editor of your choice (emacs, vim, etc.) open the .bash_profile file for editing. For example:
$ emacs .bash_profile
Add the following line to the end of the file (replacing 'you' with your Mac username):
PATH=$PATH\:/Users/you/torch/install/bin ; export PATH
Save and exit the text editor
Source the changes by running:
$ source .bash_profile
Check that your PATH has been updated (look for /Users/you/torch/install/bin in the string returned):
$ echo $PATH
To make sure it has been changed permanently, completely quit Terminal, open it and run echo $PATH again
Now try th and it should run Torch!
For more help on PATH:
https://kb.iu.edu/d/acar
The Torch installation (at least for me) added the line . /Users/jb/torch/install/bin/torch-activate to my .profile file, not .bash_profile. I tried adding that exact line to .bash_profile but it didn't work, so based on the recommendations here I got rid of the trailing directory and such.
Have you updated your PATH? It should include something like
/home/user/torch/install/bin
I faced the same issue and following this post deleted and reinstalled everything. However in the end what helped was adding /home/user/torch/install/bin/ to the PATH variable.
I have resolved the issue. I have deleted torch and I have installed it again. I have updated my PATH, and I have ran the $ luarocks install image command. After all of these, I was able to ran $ th command and in general torch.

-bash: /usr/local/bin/heroku: /usr/local/bin/ruby: bad interpreter: No such file or directory

Whenever I open a new terminal window I now get:
-bash: /usr/local/bin/heroku: /usr/local/bin/ruby: bad interpreter: No such file or directory
Any idea as to why this is happening and how to get rid of it?
Make sure the first line of the file /usr/local/bin/heroku is #!/path/to/ruby. You may need to change it from /usr/local/bin/ruby to /usr/bin/ruby, or if you cannot find the ruby executable, type which ruby or updatedb && locate ruby to find it.
If the above doesn't work...
Check your ~/.bashrc, ~/.inputrc~, /etc/bashrc, /etc/inputrc, /etc/profile for a line trying to execute /usr/local/bin/heroku.
Another idea is you might have this as one of your startup programs. Check in /etc/inittab for a line with /usr/local/bin/heroku.
If you still cannot find that line in any of those files you can run grep -iH heroku /*
brew install wget
wget -qO- https://toolbelt.heroku.com/install.sh | sh
-bash: /usr/local/bin/heroku: /usr/local/bin/ruby: bad interpreter: No such file or directory
You should firstly read the massage that the terminal throw out. /usr/local/bin/ruby: bad interpreter: No such file or directory that means there is no valid ruby command in the /usr/local/bin. So if you have install ruby but in another directory. You can use ln -s to link the /usr/local/bin/ directory. So find it out, such as /usr/bin/ruby. You can get into/usr/local/bin/directory run ln -s /usr/bin/ruby. If you have not started installing ruby, you should install it and make sure the ruby command in the /usr/local/bin directory
How did you install heroku? If from source, you should recompile with proper directories.
You can edit /usr/local/bin/heroku but I think better when you recompile it (who knows where are more bad settings in heroku).
I had a similar problem which resulted in the following error message when I tried to run any heroku commands:
(~/).gem/ruby/1.8/bin/heroku: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
After some searching, I found a copy of the heroku-api gem in ~/.gem/ruby/1.8/cache. Deleting it and deleting the rubygems reference file in ~/.gem/ruby/1.8/bin solved the problem.
I was running "pod init" in a directory. This gave me a similar error:
-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
Solution: install Cocoapods following the directions on their website.

Resources