Ruby installation results in Terminal opening as cat - ruby

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.

Related

Weird combination of numbers and letters in front of terminal prompt macOS

Curious as to why I have the sequence : h-63-4 in front of my terminal prompt.
Example: (base) h-63-4:~ axel$
Screenshot
I believe I was messing around with virtual environments in python when it first started appearing, but haven't been able to figure out as to what's causing it.
Contents of my .bashrc:
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi
PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
[ -r "/etc/bashrc_$TERM_PROGRAM" ] && . "/etc/bashrc_$TERM_PROGRAM"

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

What does `[[ -e ~/.profile ]] ` mean in zsh shell?

I wanted to make zsh load ~/.profile at login. And I found this zsh-not-hitting-profile
Gilles's answers adding emulate sh -c '. ~/.profile' in ~/.zprofle
does work.
But I wonder why Frank Terbeck make an addition to it:
[[ -e ~/.profile ]] && emulate sh -c 'source ~/.profile'
I am not very familiar with linux shell so I don't understand what he says:
And it's only active during the source. So you do not have to save the current option state in order to replay it again after sourcing.
only active during the source? I need ~/.profile always need to be source , I can't get the meaning, because emulate sh -c 'source ~/.profile simply works everytime I logined.
save the current option state in order to replay? what is the option state, why I need to replay?
[[ -e ~/.profile ]] simply tests whether the file ~/.profile exists. This way you won't get an error doing source ~/.profile if the file isn't there.
"only active during the source" means that the -c option that you give to the emulate command doesn't change the options to the original shell process. It just uses that temporarily during the emulation of the source command.

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.

Issue in Rvm Installation, running in binary mode

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

Resources