How to fix this error - macos

When I open terminal system shown error below
-bash: /etc/profile.d/sm.sh: No such file or directory
-bash: /etc/profile.d/rvm.sh: No such file or directory
Thank you.

Looks like you used to have rvm or something, and then removed it? Anyway, remove the offending files from /etc/profile.d and you should be fine.

Related

bash-compl and bash-completion: no such file or directory

Whenever I open a terminal, the following errors pop out instantly:
bash: /usr/share/bash-compl: No such file or directory
bash: etion/bash_completion: No such file or directory
Also, when I try to compile my ~/.bashrc I get the same errors.
What should I do?
P.S. (I'm using Ubuntu 16.04 LTS)
There was a newline in ~/.bashrc which caused the breaks in those lines. Removing it fixed the issue.
Following steps worked for me:
Go to /etc/skel and do ls -a.
Locate .bashrc.
Copy that or open it with any editor and copy it to the home .bashrc file.

How to delete echo commands to set Ubuntu's opening directory that were incorrect?

I redownloaded Ubuntu on Windows 10 and I was resetting the root directory that is opened when Ubuntu is launched by calling
echo "cd ~/../../mnt/c/Users/jilli/Desktop" >> ~/..bashrc
However, the first couple times I called this I wrote the wrong directories. Therefore, there are 5 lines at the top of Ubuntu every time I open it trying to get into these directories stating "No such file or directory" which I have pasted below. How do I delete these calls?
-bash: cd: /home/jpenfield/Desktop/: No such file or directory
-bash: cd: /home/jpenfield/mnt/c/Users/jilli/Desktop: No such file or directory
-bash: cd: /home/jpenfield/mnt/c/Users/jilli/Desktop: No such file or directory
-bash: cd: ~home/jpenfield/mnt/c/Users/jilli/Desktop: No such file or directory
-bash: cd: /home/jpenfield/home/jpenfield/mnt/c/Users/jilli/Desktop: No such file or directory
Open ~/.bashrc in your preferred text editor and remove the lines that you don't need.
For example,
$ nano ~/.bashrc
Just edit the file
vi ~/..bashrc

Remove file or directory from Terminal that is already gone in Finder

I deleted some files/folders and moved some other folders around in my Finder. Now every time I open up terminal, the first 4 lines always list 4 files or directories like this:
-bash: cd: file-name: No such file or directory
-bash: cd: file-name: No such file or directory
-bash: cd: file-name: No such file or directory
-bash: cd: file-name: No such file or directory
I have tried to remove them using rm but just get the same message, restarting Terminal many times, and restarting my mac many times, etc I can't find them in Finder either. How do I clear terminal so it doesn't try to "look into" these non existing files or directories? I am thinking it is still reading in a path somehow, but I am fairly new to mac and terminal.
Check your bash_profile for any reference to the deleted files. If there are any deleted files listed there, remove the lines from the file and save the bash_profile. Restart Terminal.

can't access .bash_profile

So I was adding a path to my bash profile, and I accidentally started it with 'myname 1' instead of 'myname1'. I think the space has messed something up.
When I open my terminal now, I get:
-bash: export: `1/Documents/android-sdk-macosx/platform-tools:/Users/XXXX/Library/PreferencePanes/MMPane.prefPane/Contents/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin': not a valid identifier
-bash: dirname: command not found
-bash: /Users/bin/git-prompt.sh: No such file or directory
I know the '1/ is super messed up, but now when I try to edit the profile again nothing works. I can't access it with nano or anything. I don't even think it can find my profile anymore.
Does anyone know how I can access that old profile to fix the edit I made?
It's likely that your PATH environment variable has now been set to myname, and so trying to run a command foo will now only work if an executable named myname/foo exists. The way around this is to give the absolute path of any program you want to execute. For example, nano most likely resides in your /usr/bin directory, and so you should be able to run it to edit your .bash_profile by typing:
/usr/bin/nano ~/.bash_profile
If that's not the correct path, other likely locations for nano include /usr/local/bin/nano and /usr/pkg/bin/nano; the correct answer depends on your operating system and distribution thereof.
Type the full path to the editor.
I assume the following will work:
/bin/vi .bash_profile

-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