My current environment (including a corporate proxy) is not allowing me to install RVM with CURL or WGET for something reason. Is there another way to install RVM from source without these utilities? Every web search I've done returns the 'curl' way.
Any ideas?
modifying rvm scripts is not a good idea
I was thinking about your question/my answer while trying to sleep... and I couldn't get an eye closed without writing you another answer. Hacking the rvm install script is really not what you should do. Rvm uses curl everywhere (installation, downloading rubies, updating, ...). And you have to download many more things -- for example gems. Replacing every curl-call in every script is not maintainable.
proposed solution
The good thing about rvm is, that is stores all its data in the ~/.rvm directory. Considering this, you can install rvm on a remote computer (or VM), which is as similar as possible (same OS, same OS version, same libraries) to your development computer. Install all the rubies, gemsets and gems you need. Then move the zipped ~/.rvm directory to your development computer and unpack it to ~/.rvm.
Don't forget to do
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
to source rvm while loading your bash.
If you ever have to update or install gems or ruby versions, do your business on the remote computer, and copy ~/.rvm again.
my experience with this setup
I use this setup (although it is automated with our CI server) for ¬2 years now for a production environment which is in a similar wicked corporate network. Changing gems/rubies is harder than it should be, but it works without an internet connection.
Edit: Added a paragraph about my experience with this setup
You find the rvm install script here. You can
download it
modify the parts where curl is used
execute the script, which now refers to the manually downloaded files
1. Download
Download this file to /tmp/rvm-installer .
Now download the rvm.tar.gz file to /tmp/rvm-1.19.6.tar.gz
2. modify the file
At line 148 begins function fetch_version. Replace it with the following function:
fetch_version()
{
echo '1.19.6' # the current version, as of writing this
}
At line 161 (within install_release) the get_and_unpack function is called.
replace the function call with:
get_and_unpack \
/tmp/rvm-${_version}.tar.gz \
rvm-${_version}.tar.gz
At line 212 (within get_and_unpack) replace
__rvm_curl ${_url} -o ${rvm_archives_path}/${_file} ||
with:
mv ${_url} ${rvm_archives_path}/${_file} ||
3. finally install rvm
cd /tmp
cat rvm-installer | bash -s -- --version latest --autolibs=enabled
Disclaimer: This is still a hack. It installs rvm, but I don't know about updating (here rvm uses curl again). Good luck :)
Related
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.
I am new to RVM and looking to use it as I deploy my Rails app to a Digital Ocean server. I am following this tutorial and trying to get my Mina script to run (similar to Capistrano). The script includes a set up section with these lines:
source /etc/profile.d/rvm.sh
rvm use || exit 1
Unfortunately, rvm.sh does not exist in /etc/profile.d (or anywhere else on my server). rvm seems to be installed just fine (I can set list rubies, set my Ruby default version, etc). I'm not even sure what rvm.sh would contain if it existed.
Thanks in advance for any help or suggestions you can provide.
#mpapis got me on the right path here. I had installed rvm under one user, but not for this user. I wound up uninstalling rvm and starting from scratch, installing rvm for multiple users.
I've been attempting to install rvm system-wide on a Red Hat Enterprise 6 system. In three tries, it always installed to my home directory.
I am a sudoer; sudo yum install emacs installed a /usr/bin/emacs.
Here is the command I gave:
sudo \curl -sSL https://get.rvm.io | bash -s stable --rails
Except for the --rails option, it's a straight copy from the installation instructions.
Regardless, the first line of the output is "Installing RVM to /home/fritza/.rvm/", and the next to last is "To start using RVM you need to run source /home/fritza/.rvm/scripts/rvm". There is no /usr/local/rvm, which is supposed to be a result of a system-wide installation.
I can't find any reference to this problem. Any ideas?
A possibility:
This is a system managed by a bureaucracy at the large higher-ed institution I work for. Maybe there is some kind of access control that blocks me from /usr/local. But if that were the case, surely the installer would have told me and quit, rather than switch over to a local install?
Other possibility:
RVM chooses the install location solely on the basis of whether it’s invoked through sudo. Could there be something in my installation that makes the installer believe it was launched into my environment?
Embarrassing error on my part...
I placed the sudo command at the start of the line instead of after the bar, for the invocation of bash.
I recently re-installed my operating system and before that i made a backup of my ~/.rvm folder that contains all my gems, ruby installations and configurations.
Doing all those steps from scratch is a bit difficult due to my internet being painfully sluggish.
So my question is:
Is there any way to have the same configuration as before using my backup of the ~/.rvm folder.
Any help appreciated.
Installation
Put your backup back to ~/.rvm. Be sure, that you setup rvm correctly with:
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
After a source ~/.rvm/scripts/rvm (or opening a new terminal), rvm should be back.
Test if it worked
To test your installation, do the following:
type rvm | head -n 1 # should return: "rvm is a function"
Note
Ruby and some gems have binaries specifically compiled for your system. If the installed libraries have changed (or are missing), expect errors. A reinstallation of the failing gem/ruby should help.
ok, so i'm coming from a python virtualenv environment, so please bear with me...
i am trying to install rvm on a non-internet visible machine (ie it doesn't have direct outside access). so
curl -L https://get.rvm.io | bash -s stable --ruby
would not work. no problems i thought, i'll just copy the file over from another machine and do a cat that worked, however, because rvm tries to download the source files directly from the web, it again failed....
so i found that if i put the tarballs under ~/.rvm/archives, i can install rvm as a single user (and take up ~200MB of my home space)... however, i want to install for multiuser for production purposes and use .rvm directories in my project. however, my /usr/local is read only (afs mount).... so rvm fails again.
any ideas? i don't particularly like the idea of having a rvm user and group.
I believe you can supply --path=/opt/rvm to the RVM install script to change the location of a multi-user installation.
I don't believe the RVM group can be changed as it relies on that group to operate correctly.
hmm... so i decided to look at the rvm-install script (ie https://get.rvm.io). basically, it was hardcoded to /usr/local/rvm, so i just changed that to /opt/rvm.
i then also had to add a check for the rvm tarball under the get_and_unpack function:
if [ -e ${rvm_archives_path}/${_file} ]
then
true
elif curl -L ${_url} -o ${rvm_archives_path}/${_file}
then download the file at https://github.com/wayneeseguin/rvm/tarball/master into /opt/rvm/archives/wayneeseguin-rvm-master.tgz
that installed rvm fine into /opt/rvm.
however, logging back in will result in -bash: __rvm_add_to_path: command not found. this is because the profile.d script is hard coded to /usr/local/, so doing a find and replace on /etc/profile.d/rvm.sh to /opt/ did the trick.
however, all the files are still group'd to rvm. which is fine, but another group i have to justify to my unix-admin.