Issue in Rvm Installation, running in binary mode - installation

I installed rvm using commands which by convention should return rvm as a function
1) bash < <(curl -sk https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
2) echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
3) source .bash_profile
4) type rvm | head -1
should return ("rvm is a function") // and it returned, rails was perfectly fine yesterday.
It worked perfectly yesterday, but now today when I am checking out rails. Its saying rails is not installed.
type rvm | head -1
returns "RVM is Hashed".
Here is something that i got from official site, but i dont know next I should do.
So the question is:
What should be done to get the rvm installed in a function mode and not binary mode?

One possible reason might be that RVM is not being accessible from .bash_profile file so try out using .bashrc file instead of .bash_profile.
Copy and paste following commands into the terminal
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc
source ~/.bashrc
Hope it works for you. worked for me cheers !!
===== Edit =====
The following should work in all cases :
curl -L https://get.rvm.io | bash -s stable
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bashrc

You should use a login shell in console you can test it by issuing:
$SHELL -l
it is possible to configure your terminal to use a login shell:
https://rvm.io/integration/gnome-terminal/
https://rvm.io/workflow/screen/
for other terminal emulators you need to read respective manual

Related

How to programmatically install nvm and install / use npm?

SO...
I have created some scripts to help configure my shell, but I am having an issue with nvm. My script looks like...
#!/bin/zsh
set -Eeuo pipefail
echo 'Installing nvm'
touch $HOME/.zshrc
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | zsh
echo 'Setting default'
echo 'stable' > $HOME/.nvmrc
echo 'Installing default'
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install
nvm use
...but I am getting...
N/A: version "stable -> N/A" is not yet installed.
You need to run "nvm install stable" to install it before using it.
...but when I run nvm install on my terminal, it works as expected. I tried wrapping nvm install with eval(), $(), but nothing seems to work, what am I missing? Any help is much appreciated!
Answer provided by #l3l_aze!
set -E at the top of the shell script was the culprit, so I changed my script to be...
#!/bin/zsh
set -euxo pipefail
...and it works!

OSX Terminal not recognizing ~/.bashrc and ~/.bash_profile on startup

The only way my .bashrc and .bashprofile are recognized by OSX is if I specify in my terminal's preferences for the file to be targeted upon boot. Is there a reason why they're not working like they should be?
Here's the inside of my .bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" #
Load RVM into a shell session *as a function*
#Add RVM to PATH for scripting. Make sure this is the last PATH
variable change.
export PATH="$PATH:$HOME/.rvm/bin"
smiley () { echo -e ":\\$(($??50:51))"; }
export PS1="\h\$(smiley) \e[30;1m\w\e[0m\n\$ "
Inside of .bash_profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" #
Load RVM into a shell session *as a function*
# Add RVM to PATH for scripting. Make sure this is the last PATH n .
variable change.
export PATH="$PATH:$HOME/.rvm/bin"
alias b='cd ..'
Any help would be appreciated! Thanks!
In OSX, all sessions are login sessions and will not source $HOME/.bashrc, they will source $HOME/.profile or $HOME/.bash_profile. So put the following in your .bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

Mac Yosemite 10.10 Terminal Command Not found

I'm having a strange problem,
My path looks like this
$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/php5/bin/
$ vim ~/.bash_profile
[ [-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 MONGO_PATH=/usr/local/mongodb
export PATH=$PATH:$MONGO_PATH/bin
export PATH=$PATH:/usr/local/bin/composer
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/php5/bin/
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
alias composer='/usr/local/bin/composer/composer.phar'
if [ -f ~/.ssh/id_rsa ]; then
ssh-add -K ~/.ssh/id_rsa 2>/dev/null
fi
I still get command not found for most of my mongod elastic-search and other commands, please help.
I Ended up reinstalling my Mongo and ElasticSearch Engine and it works fine, some thing must have gone wrong while upgrading to Yosemite.

Something in my bashrc file causing bash: command not found?

When I open up a new shell I get:
Last login: Sun Mar 23 10:14:46 on ttys000
-bash:  : command not found
I'm not totally sure how to figure out what's going on there, as its not totally clear which command its talking about.
Is it likely something in the .bashrc file?
HISTSIZE=10000
HISTFILESIZE=20000
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export PS1="\[\e[01;32m\]\h \[\e[01;34m\]\W \$(parse_git_branch)\[\e[01;34m\]$\[\e[00m\] "
export PYTHONSTARTUP=/Users/JimShook/.pythonstartup
export WORKON_HOME=$HOME/.virtualenv
source /usr/local/bin/virtualenvwrapper.sh
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
PATH=$PATH:/usr/local/rvm/bin # Add RVM to PATH for scripting
### Added by the Heroku Toolbelt
Or maybe the bash_profile?
if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Any thoughts are helpful.
Things to check - as suggested above:
anything changed recently? if so, start there... (added new line/command/sourced file?)
look for 'control codes' in the your file(s)
Try:
cat -v ~/.bashrc ## look for '^M' or other special chars - remove if present
bash -n ~/.bashrc ## try the 'sourced files' separately
If using VI, some thing to try after opening the file:
:syntax off ## turn off colors - may be easier to see 'hidden' codes
:set list ## control codes may be visible

Ruby installation results in Terminal opening as cat

I tried to install Ruby on my computer. I used About.com guide. The terminal opens with the label cat at the top (after briefly flashing login, find, and bash), and it won't run anything I type. I think this is the result of step 6 of the guide, which told me to enter:
$ cat >>~/.bash_profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
How can I change the default shell to bash? I tried going to Preferences and changing "Shells open with" to Command /bin/bash, but no luck. I used Ctrl+D to get to bash. I updated to OS X Mavericks.
I would recommend just opening a text editor and pasting [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" into your .bash_profile. You can do this in Terminal by doing open ~/.bash_profile.

Resources