Path corrupted after installing rvm? - ruby-on-rails

It's pretty weird, but i got my PATH corrupted after installing rvm on Mac OS. I really don't understand why but i get command not found in every command i type, from 'port' to 'git'. That behaviour is really really weird, do you have any idea why this happens ? ( i installed using this : http://beginrescueend.com/rvm/install/)

It sounds like your .bash_profile was overwritten or somehow changed. I assume you have git installed as a macport. My guess is that the path to all macport installed executables was removed from your $PATH variable.
Make sure that you have the following line in your .bash_profile file:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH

Yes. Unfortunately the rvm installer DOES overwrite the contents of .bashrc and .bash_profile.
Happened to me too, but luckily I had a back up .bash_profile with all of my aliases, functions, and path defns.
Something needs to be fixed here.

Related

C:/Ruby30-x64/bin/ruby.exe: bad interpreter: No such file or directory

I'm new to rails.
Error
-bash: /mnt/c/Ruby30-x64/bin/rails: C:/Ruby30-x64/bin/ruby.exe: bad interpreter: No such file or directory
I'm trying to run server on my machine but it is showing this error. I have been working on this for quite sometime, everything was working fine. Just switched to another project and then came back here, this error showed up. Please help.
Working on WSL in windows 10.
It was a ruby version error. The ruby version wasn't set.
This helped me resolve the issue rvm use {ruby_version}#{project}
eg: rvm use 2.6.6#eloecommerce
Add the path and alias to ~/.bashrc
export RUBYBIN=/{{YOUR_PATH}}/Ruby30-x64/bin
alias ruby="$RUBYBIN"/ruby
alias ruby.exe=$RUBYBIN/ruby.exe
alias gem="$RUBYBIN"/gem.cmd
alias bundle="$RUBYBIN"/bundle.bat
alias bundler="$RUBYBIN/bundler.bat"
alias jekyll="$RUBYBIN/jekyll.bat"

RVM Upgrade Warning Files containing `PATH=` with no `$PATH` inside

I am curious as to how to fix the path of my files. I was given the WARNING message from rvm get stable --autolibs=enable and am not sure how to approach the warning.
Here is the message:
Upgrade Notes:
/Users/user/.bash_profile:1:export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/Users/user/.rvm/gems/ruby-2.1.1/bin:/Users/user/.rvm/gems/ruby-2.1.1#global/bin:/Users/user/.rvm/rubies/ruby-2.1.1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/user/.rvm/bin:/Users/user/mongodb/bin
* WARNING: Above files contains `PATH=` with no `$PATH` inside, this can break RVM,
for details check https://github.com/wayneeseguin/rvm/issues/1351#issuecomment-10939525
to avoid this warning append #PATH.
I'm really curious to see if this is part of the reason why I am seeing so many gem installation issues.
How do I fix this path and check?
Edit your .bash_profile. Change the line
export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/Users/user/.rvm/gems/ruby-2.1.1/bin:/Users/user/.rvm/gems/ruby-2.1.1#global/bin:/Users/user/.rvm/rubies/ruby-2.1.1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/user/.rvm/bin:/Users/user/mongodb/bin
to
export PATH="/usr/local/mysql/bin:/Users/user/mongodb/bin:$PATH"
. Note what I did:
I took out all the /Users/user/.rvm/… directories; you probably want RVM to manage those itself.
I took out /usr/local/bin, /usr/local/sbin, /usr/bin, /bin, /usr/sbin, and /sbin; those are almost certainly already on the PATH that the shell starts with (before running .bash_profile). It's possible /usr/sbin and /sbin are not already there; if so, you might want to add them in .bash_profile.
I put double quotes around it in case any part of it has spaces (which would be a bad idea, but it's a good idea to safeguard against it just in case).
I put :$PATH at the end -- its absence is what RVM was complaining about. This makes it so /usr/local/mysql/bin and /Users/user/mongodb/bin are added to the PATH that's supplied to the shell, rather than replacing it. And since the :$PATH part is at the very end, bash will search your custom PATH entries first and default system locations last.

Updated my path and now my program can't find my gems

I was having some trouble installing the gem libv8. Apparently I need to have python installed. I installed Python and was attempting to update my path with command from another forum:
SET PATH=C:[Ruby Directory]\bin;C:[Python Directory]
or in my case:
SET PATH=C:\Ruby192\bin;C:\Python27
I am not strong with paths and I can't figure out what I did. Now my environment can't find my Ruby directory.
Can someone explain what I did and how I might fix it?
That is most likely because your PATH variable already had a bunch of stuff that you simply throwed away with that line:
echo %PATH%
# a bunch of stuff
SET PATH=C:\Ruby192\bin;C:\Python27
echo %PATH%
# C:\Ruby192\bin;C:\Python27
You can try to append to it instead instead:
set PATH=%PATH%;C:\Ruby192\bin;C:\Python27
echo %PATH%
# a bunch of stuff plus C:\Ruby192\bin;C:\Python27
This change will be avalid for your terminal session only. Closing it and open again should restore the default path. If you need to make it permanent, you need to change your path throught the windows (for example, following this instructions)

Setting LD_LIBRARY_PATH in Cygwin

I am following the tutorial : http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html
when I reach the part where I am supposed to set the library path :
Unix or Linux:
LD_LIBRARY_PATH=`pwd`
export LD_LIBRARY_PATH
Windows NT/2000/95:
set PATH=%path%;
Neither of these work in cygwin. I keep getting an error when trying to run my program.
Cygwin doesn't use LD_LIBRARY_PATH, it looks for shared libraries in PATH, so try:
export PATH=`pwd`:$PATH
That will add the current directory to the front of the PATH.
Is that
LD_LIBRARY_PATH=$(pwd)
and you just messed up the html, or are you really running:
LD_LIBRARY_PATH=pwd
If the latter, try adding the $() to get the current working directory into the path. Also, you can
echo $LD_LIBRARY_PATH
to ensure it contains what you want. You might consider doing
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)
to avoid discarding previous contents of the path.

.bash_profile on Mac OS X Leopard breaks Rails?

I am relatively new to dealing with command line issues, compiling programs, and UNIX. Coming from a PHP background, I just fired off MAMP and never worried about this kind of stuff.
I am diving into Rails, and running into some issues. I tried to create a .bash_profile in my home directory to create some shortcuts for myself. I added /usr/local/git/bin to my .profile file, but it seems to have no effect on my PATH variable inside a new terminal window (i.e. it only lasts the session).
The .bash_profile seemed to persist across logins, but once I had that setup, Rails stopped working as expected! I would run rails server in my application's root directory, and Rails would create a new app called 'server' with another directory tree inside my existing app. It does this even with an empty .bash_profile. But I delete the .bash_profile, and everything works like normal.
I am in over my head here - I have very little understanding of how this all works. Any advice on where to look? Or am I missing something obvious?
Post what you added to your .bash_profile. To pre-pend something to your path the syntax is:
export PATH=/usr/local/bin:$PATH
to append you swap the "/usr/local/bin" and $PATH
export PATH=$PATH:/usr/local/bin
After you make changes to your .bash_profile you can make them available in the current terminal session by running source .bash_profile. Then if you run echo $PATH you can see the updated PATH. You should try running rails --version in your different configurations to see if the version is changing. That may account for your odd behavior.
also checkout:
path-helper as extend PATH is sooo 2010

Resources