I'm attempting to install homebrew on Mountain Lion so that I can install Ruby 1.9.3. After years of programming only PHP, 'm finally taking the jump into Rails, Git, etc. In anycase, I'm on a laptop that was given to me. Therefore, my login account is not the original account. I think that might be causing the problem I'm having.
When running brew doctor I get the following:
Warning: Homebrew's sbin was not found in your path.
Consider amending your PATH variable so it contains:
/usr/local/sbin
When running echo $PATH I get the following:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/Users/chadimoglou/.rvm/bin
There is no .profile in my home directory. There is a .bash_profile. It looks like this
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session as a function
Any help for this terminal noob is much appreciated.
in your .bash_profile, you can simply do:
export PATH="$PATH:/usr/local/sbin"
You can manually edit your $PATH and /bin. This guide was not too terrible it helped me understand the entire concept of $PATH /bin and being a sudoer.
Related
How do I get rid of this on my bash terminal?
I suspect that the code that triggers this is found in my .bash_profile:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Removing the line above, gives me back a prompt that Rails cannot be found, even if I have rails installed.
I had the same issue after running rvm get stable.
Since rvm needs to run in the shell session as a function, removing the line [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" from your .bash_profile or .bashrc is not an option as it will cause gems to not be found.
On my environment the cause was due to a conflict between an old installation of bash-it and rvm. If you're using bash-it and encountering this issue, this may help.
I took the following steps:
Backed up my .bash_profile (if you have .bashrc you may want to back it up as well).
Ran bash-it's uninstall script (see instructions in the link above) and removed ~/.bash-it folder.
Reinstalled bash-it.
Added to .bash_profile what was missing based on my .bash_profile backup created on step 1.
Reenabled the bash-it aliases, completions, and plugins that I needed.
As soon as I opened a new shell, I stopped receiving the error and rvm started working properly.
Can't find anything about this in Google.
Trying to get most out of vim-rails.
https://github.com/tpope/vim-rails
It has many interesting commands, like :Rserver, :Rgenerate, :Rdestroy, but they do not work on my machine. All they give same error:
No such file or directory
I would imagine it has something to do with paths, and RVM loading, but not sure what exactly.
Running on latest Lubuntu if that matters. Sometimes need to do /bin/bash --login to run rake.
--
Found somewhere that in ~/.profile I should put this:
# PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM
Still same error.
--
Yes, vim-rails - is a plugin for vim that I'm trying to use.
-- Tried to run !/bin/bash --login from VIM - but it closes VIm.
Have you try to execute these commands in the normal way?
like rails server, rails generate..
From your description, mostly because vim-rails can't find ruby or rails command to execute.
You should check the $PATH variable to see whether it has ruby or rails load path in it.
Have you tried to open vim in your working directory?
For example, if your app is in ~/workspace/my_project/, then you should open vim in that directory:
cd ~/workspace/my_project
vim
Then the vim-rails should work as expected.
My system was fine, but today, after installing MySQL server, I can't use the terminal to program my Rails application.
When I open a terminal session, I see:
Last login: Sun Dec 8 13:31:06 on console
-bash: [: missing `]'
-bash: rt: command not found
I tried searching for this error but can't find a solution.
I am running Mac 10.7 OS X.
No commands pertaining to Ruby on Rails are found.
I built an application and installed Rails, but when I run a Rails command I get:
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
How do I fix this?
My bashrc file contains only one line:
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
My bash profile contains following:
export PATH=$PATH:/usr/local/mysql/bin
[ [-s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
rt PATH=$PATH:/usr/local/mysql/bin
I checked history and this is what I ran
vi .bash_profile
vi .bash_profile
user#computer:$ mysql -u root
mysql -u root
vi .bash_profile
mysql -u root
/usr/local/mysql-5.6.15-osx10.7-x86_64/bin/mysqld_safe ; exit;
mysql
What else can I show to help with this problem?
Your .bash_profile is messed up. Modify what looks like this:
[ [-s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
rt PATH=$PATH:/usr/local/mysql/bin
To look like this:
[[-s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH=$PATH:/usr/local/mysql/bin
As #TinMan pointed out, you'll want to remove the export PATH line from your .bashrc file.
I had a similar problem (although I'm running Ubuntu). When I opened a new terminal and navigated to my project root, I was surprised to find that Rails was not recognized as a program. I checked the version of Ruby and noted that there was a discrepancy between the two terminals I had open. When I tried to switch Ruby versions with RVM, I was told
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
so I ran /bin/bash --login. Then, I was able to switch to Ruby 2.1.1 with RVM use ruby-2.1.1 and all my rails commands worked again.
Basically what happened is that RVM only installs gems locally for each Ruby verison. Unless you select the version of Ruby that you were using when you installed the gem, you won't be able to use the gem unless you reinstall it.
I came to this page after receiving this error with a slightly different cause. While the CDub's answer is directly applicable to OP's question, I would generally recommend users of Mac OS X Terminal who have this error to do the following:
Open ~/.bash_profile in a text editor.
Look for any instances of "rt" at the beginning of a line.
Change all instances to "export".
It looks like some packages out there are writing a command into ~/.bash_profile that Mac OS X does not like, and we need to manually correct this.
For reference, I am on OS 10.10.2.
I know the above question is very common question. I have gone through multiple posts on this topic. But I didn't get any resolution.
I have installed rvm locally. We already have the installation files. SO went into the folder and run the install command.
$ ./install
Then I checked ./rvm folder in the Users home folde
$ cd ~/.rvm
folder exists. Hence Installation is successful.
Now I am typing rvm in the command line
$ rvm
I am getting below exception
$ rvm
-sh: rvm: command not found
After reading the multiple articles in stackoverflow on this issue, I learned that I have to add the below lines in .bash_profile as I am using Mac OSX 10.7.3
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Even after I am getting same exception while typing rvm. Is there any thing extra I need to do? or Am I missing some thing? Please help
Steps to try out:
Log out and login to your system.
Open a new terminal and manually run
source $HOME/.rvm/scripts/rvm
then
rvm
Check these work-arounds.
Update:
To avoid running
source $HOME/.rvm/scripts/rvm
every time you open a terminal, include this line into ~/.MacOSX/environment in your Mac (This is similar to ~/.bashrc in GNU/Linux-based systems under $home aka ~ directory).
In my case, i am using Ubuntu Bash in Windows 10 and to fix the problem i used:
source /usr/local/rvm/scripts/rvm
For those that are doing this in 2018 just
add
source $HOME/.rvm/scripts/rvm
to your .bash_profile within your home directory.
you need to enable login shell in terminal emulator preferences, sometimes it is needed to use /usr/bin/bash --login, here is an example https://rvm.io/integration/gnome-terminal/
after enabling login shell you need to close terminal application and open it fresh.
I just had to open a new Terminal session.
After I installed it using:
curl -sSL https://get.rvm.io | bash -s stable --ruby
rvm install 2.2
For Ubuntu 18.04, I had to run the command below to solve the issue after rvm was installed using instruction from here.
source /usr/share/rvm/scripts/rvm
This is one of other options available for RVM:
source /etc/profile.d/rvm.sh
After upgrading to ubuntu 11.04 I am having this problem with rvm.
I am following this tutorial:
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#top
Git is installed OK, when I follow the instructions on RVM website apparently it's OK too, but when I close my terminal and open a new one and type ruby -v or rvm -v for example I got a message "rvm is not installed".
What should I do?
After some Googling I found:
http://ygamretuta.me/2011/05/09/install-rvm-in-ubuntu-11-04-and-mac-osx-snow-leopard/
which worked for me (Ubuntu 11.04, x64)
Edit your .bashrc file instead of your ~/.bash_profile file with your favorite editor
vim .bashrc
add this to the bottom:
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi
Hope this helps guys!
Check do you have ~/.bash_profile and add next code in it (create file if it does not exists):
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Also, if you use gnu screen you should add
source ~/.bash_profile
to the end of your ~/.bashrc file.
Then type
type rvm | head -1
in your terminal and you should get message "rvm is a function"
After that you would be able to follow instructions on RailsTutorial.
I recently wrote up a tutorial on getting RVM up and running on Ubuntu 11.04: http://blog.dcxn.com/2011/06/20/setting-up-rvm-on-ubuntu-11-04/
Hopefully it helps if you have future problems or if there are still questions.
I had a similar problem and will list the steps that worked for me:
Following this article was very helpful (even if I have 11.04 installed)
The installation was performed with sudo privileges
The installation didn't added /usr/local/rvm/bin to PATH
Hope this helps to someone