I am installing rvm on Ubuntu Server 11.10 following the excellent guid: http://blog.ninjahideout.com/posts/a-guide-to-a-nginx-passenger-and-rvm-server
Since the link is broken in the article, I use the script from RVM Homepage to install the rvm for multiple users:
sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
As per the blog post by Darcy, after the installation, /usr/local/lib/rvm will be created:
/usr/local/lib/rvm – a simple shell script to intelligently load rvm.
But I could not find it in my system, and also I could not find any example of this file from google to create by myself, would you help me why it is working as described in my system? How could I fix it?
It is located in ~/.rvm/bin/rvm
Exctracted from the install script
if [[ -z "${rvm_path:-}" ]]
then
if (( UID == 0 ))
then
rvm_path="/usr/local/rvm"
else
rvm_path="${HOME}/.rvm"
fi
fi
export HOME rvm_path
Related
I've been trying to install homebrew without admin privileges on my school MacBook (Mojave 10.14.6) for the past 2 weeks. I've seen many things on the internet, saw some scripts, tutorials, but nothing seems to help.
I used this script (did some tweaking to it like changing to a new repository and setting absolute path)
https://gist.github.com/skyl/36563a5be809e54dc139
the repository I used is
https://github.com/Homebrew/brew
my path to brew is
/Users/as.gurban-zade/Desktop/homebrew/usr/local/bin/brew
I added this to the $PATH using
echo "export PATH=/Users/as.gurban-zade/Desktop/homebrew/usr/local/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profile
also tried
echo "export PATH=/Users/as.gurban-zade/Desktop/homebrew/usr/local/:$PATH" >> ~/.bash_profile && source ~/.bash_profile
After everything I did, I still get
-bash: brew: command not found
Updating OS to Catalina is possible if that would help
I'm trying to execute a bundle install via RubyMine but I'm receiving the following error message:
Error Message:
Set the environment variable ORACLE_HOME if Oracle Full Client.
Append the path of Oracle client libraries to LD_LIBRARY_PATH if Oracle Instant Client.
I'm using Oracle Instant Client and my ~/.bash_profile contains this:
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
I have no issues when I try bundle install via terminal. I suspect that Rubymine is not loading the same environment variables that the terminal app loads when it starts.
run RubyMine, go to Tools -> Create Command-Line Launcher, it should create a /usr/local/bin/mine file.
Edit your RubyMine launcher in Ubuntu, and make it execute bash -ic '/usr/local/bin/mine' (the -i is for an interactive shell)
That will launch RubyMine after loading your profile files (.profile, .bashrc ...)
Sounds like you're running RubyMine from your desktop manager and none of the parents of the desktop manager run your ~/.bash_profile. Fixing that would be an Ubuntu question.
But you could
find the RubyMine executable on disk and run RubyMine by typing the full path of the executable in a terminal (and you could make an alias), or
run RubyMine, go to Tools -> Create Command-Line Launcher, and use the launcher that it creates.
I have a Homebrew installation in $HOME/brew, and historically it has worked well. Unfortunately, over time Homebrew has become less and less tolerant of installations outside of /usr/local. Various formulae make hard assumptions about the installation prefix, and do not work properly (i.e., were not tested) with a non-standard prefix. The brew doctor command even goes so far as to warn about this now:
Warning: Your Homebrew is not installed to /usr/local
You can install Homebrew anywhere you want, but some brews may only build
correctly if you install in /usr/local. Sorry!
As such, I would now like to migrate my Homebrew installation over to /usr/local. However, I am loath to simply mv all the files, as I suspect this will cause problems. I could not find any instructions on the Homebrew site or here on migrating an existing installation to a new prefix. Of course, I could uninstall Homebrew and then reinstall it, but I would prefer not to rebuild all my kegs.
Is there any existing script or documented practice for performing such a migration?
Or is this impossible due to hardcoded absolute paths in linked binaries?
The modern way to do this is with homebrew-bundle.
brew tap Homebrew/bundle
brew bundle dump # Creates 'Brewfile' in the current directory
# later ...
brew bundle # Installs packages listed in 'Brewfile'
I just wrote a script to achieve the goal to migrate homebrew packages to a new system, which also applies for your case (named backup-homebrew.sh):
#!/bin/bash
echo '#!/bin/bash'
echo ''
echo 'failed_items=""'
echo 'function install_package() {'
echo 'echo EXECUTING: brew install $1 $2'
echo 'brew install $1 $2'
echo '[ $? -ne 0 ] && $failed_items="$failed_items $1" # package failed to install.'
echo '}'
brew tap | while read tap; do echo "brew tap $tap"; done
brew list --formula | while read item;
do
echo "install_package $item '$(brew info $item | /usr/bin/grep 'Built from source with:' | /usr/bin/sed 's/^[ \t]*Built from source with:/ /g; s/\,/ /g')'"
done
echo '[ ! -z $failed_items ] && echo The following items were failed to install: && echo $failed_items'
You should first run this script on your original system to generate a restore script:
./backup-homebrew.sh >restore-homebrew.sh && chmod +x restore-homebrew.sh
Then, after installing Homebrew on your new system (in your case the same system), simply run restore-homebrew.sh to install all those packages you have on your original system.
The benefits of this script over the one given by #ctrueden is that this script also tries to back up the installation options you used when you installed the packages.
A more detailed description is in my blog.
As suggested by Peter Eisentraut, I indeed ended up migrating my Homebrew installation by reinstalling it. You can script things a bit to retap all your extra taps, and reinstall all your previously installed kegs, without too much manual work:
#!/bin/sh
# save list of kegs for later reinstallation
brew list > kegs.txt
# back up old Homebrew installation
mv $HOME/brew $HOME/old-brew
# install Homebrew into /usr/local
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# retap all the taps
# NB: It is not enough to move the tap repos to their new location,
# because Homebrew will not automatically recognize the new formulae.
# There might be a configuration file we could edit, but rather than
# risk an incomplete data structure, let's just retap everything.
for tapDir in $HOME/old-brew/Library/Taps/*
do (
cd $tapDir
tap=$(git remote -v | \
grep '(fetch)' | \
sed 's/.*github.com\///' | \
sed 's/ (fetch)//')
/usr/local/bin/brew tap $tap
) done
# reinstall all the kegs
/usr/local/bin/brew install $(cat kegs.txt)
# much later... ;-)
rm -rf kegs.txt $HOME/old-brew
Of course, customized Homebrew installations will have additional wrinkles. For example, if you have committed changes to any of your Homebrew-related Git repos, you may want to import that work before reinstalling your kegs or blowing away your old installation:
cd /usr/local
for f in $(find . -name '.git')
do (
repoDir=$(dirname $f)
cd $f/..
git remote add old-brew-$f $(dirname $HOME/old-brew/$f/..)
git fetch old-brew-$f
) done
Note that I only tested the second snippet above very lightly, as I personally have not customized my Homebrew in such a way.
Another aspect of Homebrew not addressed by this approach is custom flags using during your original installation. For example, to install wine you need to install various dependencies with the --universal flag, and the script above will not reinstall them with such flags enabled. See #xuhdev's answer for a solution that does so.
Or is this impossible due to hardcoded absolute paths in linked binaries?
Indeed. You'll need to reinstall everything from scratch.
I was trying to switch to zsh and oh-my-zsh console for RubyonRails projects. However after installing and appending "[[ -s "$HOME/.rvm/scripts/rvm" ]] && . “$HOME/.rvm/scripts/rvm”" to .zshrc, I am getting the error as
/home/pratuat/.zshrc:33: no such file or directory: “/home/pratuat/.rvm/scripts/rvm”
➜ ~ cd /home/pratuat/.rvm/scripts
➜ scripts ls
alias disk-usage help migrate rvm
aliases docs hook monitor rvm-install
array env info notes selector
base environment-convertor initialize override_gem set
cd extract install package snapshot
cleanup extras irbrc patches tools
cli fetch irbrc.rb patchsets update
color functions list pkg upgrade
completion gemsets maglev repair version
current get manage requirements wrapper
db group match rtfm zsh
default hash md5 rubygems
permissions to the rvm file is ok, but ~/.zshrc is still not getting it
carefully inspect [[ -s "$HOME/.rvm/scripts/rvm" ]] && . “$HOME/.rvm/scripts/rvm" statement. You may copy this from others' blog post. If you are on mac,try to replace "." with "source", sometimes this will work.
The actual problem is with the quotes in “$HOME/.rvm/scripts/rvm”
Try replacing your line with the one below and it might work
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
Note that there is a difference between “” and "".
I've found a couple similar posts regarding this same problem, but none of the solutions seem to apply, here.
On a fresh Ubuntu 10.10 install, I follow the instructions for installing RVM:
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
Then I create .bash_profile and add the following line:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
I restart the terminal and check RVM:
$ type rvm | head -1
-bash: type: rvm: not found
As the RVM installation guide explains to do so, I replaced the first line (below) in .bashrc with the second one, then indented everything in the rest of the file and added a fi.
[ -z "$PS1" ] && return # original
if [[ -n "$PS1" ]]; then # replaced with this
Restarted terminal and still, no luck.
Then, I removed the line I added to .bash_profile in the beginning and added it to .bashrc, even though that isn't what the guide said to do. Still, no luck. I also entered it directly on the command line, with no change in behavior. When I run .rvm from ~/.rvm/bin/rvm it complains that there is no such file or directory as /.rvm/scripts/rvm and that the command was not fund.
Of course, there isn't any such "scripts" directory inside of ./rvm, either -- so I'm not sure why it's looking for one? The only directories inside of .rvm are
archives
bin
config
gems
gemsets
log
man
rubies
src
tmp
user
The only thing I've found while googling for answers are other people complaining of similar problems and people telling them to add the instructed line to .bash_profile (which I obviously already did). At this point, I have nothing more to go on and am at an impasse.
Regards.
Resolution:
As Andrew Marshall advised in his comments, below, I did an 'rm -rf .rvm' and reinstalled rvm. I had actually attempted this two times before posting here, with the same results every time. No odd messages in the install log, but no /scripts/ directory, either. Just so I could say I had, I did it a third time at Andrew's urging. This time, I checked and the /scripts/ directory existed. Running 'type rvm | head -1' confirmed it as a 'function' and I can now move on.
Make sure that you restart a session after reinstalling, so that rvm is in your path.
You can try to logout/login.
You can also open your shell as a login shell. Under ubuntu 12.04:
Open a terminal
Edit > Profile Preferences
Under tab Title and Command, check run Command as a login shell
Open new terminal (ctrl+alt+t) and type rvm
If there's no scripts directory inside .rvm, it would seem that RVM failed to successfully complete installation. Delete the .rvm directory, try reinstalling, and look at the installation output closely to see if it's complaining about anything.