RVM not changing ruby version on cd (with bash-it) - bash

I've installed bash-it recently and I noticed it broken RVM. When I enter a project directory, the ruby version is not changed (not matter if I use .rvmrc or .ruby-version). However, when I enter a project directory and then open a new tab/window in terminal, ruby version is changed. I tested it in Konsole and Gnome Terminal. I keep bash-it configuration in .bash_profile and I'm loading it in the end of .bashrc. Any ideas for the reason for such a strange behaviour?
EDIT: I tried to start bash as a login shell, but it doesn't work.

Related

RVM's auto-detect Ruby version via repo files feature is not working in VSCode login shell terminal

RVM has a feature to detect and use the correct Ruby version based on e.g. a .ruby-version file in the repo. This requires a login shell which I have enabled in VSCode via:
"terminal.integrated.shell.linux": "bash",
"terminal.integrated.shellArgs.linux": ["--login"],
However the feature isn't working by default, I have to cd . every time I open the terminal as if it is not a login shell.
There's a similar issue about new tabs in a gnome shell: https://github.com/rvm/rvm/issues/2519
I wonder if anyone else ran into this and whether this might be an issue with VSCode or RVM?
The reason this doesn't work by default is because rvm hooks the cd command in the shell to setup the ruby/gem paths for your project and there's no cd issued to the shell by the VS Code terminal opening.
I was able to resolve this issue on my Linux system by adding the login setup as suggested in the question and then adding a simple cd . at the end of my ~/.bash_profile after the section where RVM is actually set up.
Doing this results in rvm properly adjusting the paths in the VS Code terminal.
This may be a workaround..
Add this in vs
"terminal.integrated.shellArgs.linux": [
"cd ."
],

RVM trying to load old Ruby version

UPDATE: I just quit all instances of Terminal and opened a new window, and apparently the message is not showing anymore.
I uninstalled ruby-2.1.0, installed ruby-2.1.3 and made it the default with RVM on Mac OS X.
Now everytime I open a new terminal window I see this:
ruby-2.1.0 is not installed.
To install do: 'rvm install ruby-2.1.0'
I looked on .bashrc, .bash_profile, .profile and .rvmrc, but I don't see anything trying to use ruby-2.1.0. I also updated the .ruby-version files.
rvm list shows ruby-2.1.3 as the current and default ruby.
How do I stop that message from appearing?
When you go into a Rails project directory in your terminal, RVM looks up the .ruby-version file and if it finds it, it checks the Ruby version specified inside this file, then if that Ruby version is not installed on your system by RVM, it gives you the message you are getting.
This is actually very helpful, allowing to know your project is using a Ruby version which is not installed on your system
The solution for me was to just quit all instances of Terminal and reopen it.
If anyone else is having this problem, check also Ali's answer regarding the .ruby-version file.

Homebrew version of vim won't open files

I installed vim via brew so I could have the latest version (7.4) and get syntax highlighting for Clojure. No big deal. Unfortunately, the brew version of vim seems to be broken on my system. I also aliased the vim command:
brew install vim # Install went successfully
alias vim=/usr/local/Cellar/7.4.052/bin/vim # Shouldn't be any problems here
When I open the brew version of vim, it fails to load any of my plugins (I use spf13) throwing a bunch of "Undefined variable" and "Invalid expression", etc errors for every plugin in my bundle directory; I just hit enter to continue. My .vimrc loads properly. When I open a file, it opens two tabs, both blank. One is a new file, the other is the file I tried to open, except there's nothing in it.
Potentially useful information: echo $VIM returns an empty line, while echo $ZSH returns /User/bsima/.dotfiles as expected.
Here are my dotfiles, but I don't think the problem lies in those configuration files.
Is this a known bug? Or is something wrong with my vim install?
I have no idea what's going on and I really miss my vim :( As good as Textmate is, I can't be without vim forever.
Edit: MacVim, installed via Homebrew, kinda works. It still opens 2 tabs on startup, but it does open files for editing and saves.
I found the problem: it was with my spf13 vim config. The following commands fixed the issue, in addition to double-checking that symlinks such as ~/.vim and ~/.vimrc were correct:
> which vim # This should output /usr/local/bin/vim since I'm using Homebrew
/usr/local/bin/vim
> cd ~/.spf13-vim-3
> ./bootstrap.sh # Basically re-installs spf13

bash __git_ps1 command not found

I am a beginner trying to setup a developer environment on my new Mac following the steps from this link: http://vanderveer.be/setting-up-my-perfect-developer-environment-on-osx-10-8-mountain-lion-10-8-2-final-edition/.
After executing the files from git, my terminal window now shows:
rbenv: version `1.9.3-p194' not installed
-bash: __git_ps1: command not found
The first line only shows when I open a new terminal window, while the second shows everytime I press return no matter what I type into the terminal.
I have read through many questions on stackoverflow and tried to mimic their solutions to no avail. I think I've made a mistake in installing the package from git as I am not so experienced and I think now I may have messed up the configurations, and was also wondering if there is any way to go back to default settings for bash?
Many thanks!
Allen
If you've not installed a newer version of Git on your Mac, start by doing that. You can grab the download from here: http://git-scm.com/download
Once it's installed, you should source git-completion.sh and git-prompt.sh from your ~/.profile (or ~/.bashrc, if you have it):
source /usr/local/git/contrib/completion/git-completion.bash
source /usr/local/git/contrib/completion/git-prompt.sh
That should fix the __git_ps1 error.
I'm not a Rubyist, but the rbenv error is coming from the fact that the setup in the dotfiles you are following is trying to set the default Ruby version to "1.9.3-p194". The rbenv tool is there to make a number of different Ruby versions available, but you have to install them first. In your case, I think you need to run this:
rbenv install 1.9.3-p194
After that, the version will be available, and you shouldn't see the warning anymore.

Change back to bash from zsh? OSX Lion

I am trying to setup my computer for Ruby on Rails development. All new to this.
Though I have had some problems with my Rails installation and want to reset everything and start again on setting it up.
The problem I get now is installing and using bash in Terminal except of the installed zsh.
I´m trying the command ➜ ~ rvm install 1.9.2
but only get:
zsh: correct 'rvm' to 'rvim' [nyae]?
which opens the file in an texteditor.
Isn´t it supposed to be a downloadable file, which should be installed automaticly ?
It sounds like rvm is not on your path. You could specify the executable location explicitly:
~/.rvm/rvm install 1.9.2
(or maybe /usr/local/rvm/rvm depending on where you installed it)

Resources