Ever since installing RVM, my manpages are broken. Current versions of man don't use the MANPATH variable, so why is it being set to .rvm/man and why isn't there a full catalog of manpages inside that folder?
Apparently in the script ~/.rvm/scripts/initialize there is a little block that sets MANPATH and exports. Just comment this block out. Modern manpages compute path dynamically.
The offending lines are:
# if [[ -z "${MANPATH:-}" ]]
# then
# export MANPATH="${rvm_man_path}"
#
# elif ! [[ ":${MANPATH}:" =~ ":${rvm_man_path}:" ]]
# then
# export MANPATH="${MANPATH}:${rvm_man_path}"
# fi
This was fixed already as #Ashely noted in comment, proper way is to update RVM: rvm get head and to open new terminal / relogin depending on the installation type.
Related
I had to get a new hard drive on my Mac and in setting up my developer environment, I'm getting this error/message in the terminal (iTerm2):
-bash: unset: `PATH=/usr/local/opt/icu4c/bin:/usr/local/share/npm/bin:/Users/(mycomputername)/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/(mycomputername)/bin': not a valid identifier
From what I've been able to research myself so far, it might be related to installing node using brew. (I could be wrong.)
FYI:
which ruby
/usr/bin/ruby
which node
/usr/local/bin/node
which python
/usr/local/bin/python
Also, I'm using these instructions to set up. I'm aware a few things in this list are out of date:
https://github.com/nicolashery/mac-dev-setup
EDIT:
Contents of ~/.bash_profile:
# Add Homebrew /usr/local/bin and User ~/bin to the $PATH
PATH=/usr/local/bin:$PATH PATH=$HOME/bin:$PATH
export PATH
# Load the shell dotfiles, and then some: # * ~/.path can be used to extend $PATH.
# * ~/.extra can be used for other settings you don’t want to commit.
for file in ~/.{path,bash_prompt,exports,aliases,functions,extra};
do [ -r "$file" ] && source "$file"
done
unset fileexport PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
The issue is this line in your ~/.bash_profile:
unset fileexport PATH="/usr/local/opt/icu4c/bin:$PATH"
comment it out with # and restart iTerm2
I am installing Ruby on Rails on Mac OS X. The tutorial I am following says to add:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
to ~/.bash_profile.
What does this line do?
Thanks
[[ -s "$HOME/.rvm/scripts/rvm" ]]
This portion is a test condition ([[ is the new test command). -s returns TRUE if the file rvm present over at $HOME/.rvm/scripts/ location exists and is of size greater than zero.
&&
This is a logical and operator. It executes the statement on the right IF AND ONLY IF statement on the left returns true.
. "$HOME/.rvm/scripts/rvm"
. is short for source command. You are sourcing the file in your current shell and not forking a new sub-shell
It checks if the file exists and has size great than zero, and if so, it executes the file.
The file is "$HOME/.rvm/scripts/rvm. $HOME is a variable, usually set to your homedir (~), something like /home/youruser. In that directory you should find a hidden folder .rvm, which contains a folder scripts, which contains an executable file called rvm.
I just installed rvm and run rvm notes as a shell command. The output includes besides other useful information the following lines.
If you wish to use RVM in an interactive fashion in other shells
then place the following line at the end of your shell's loading files
(.bashrc or .bash_profile for bash and .zshenv for zsh),
after all PATH/variable settings:
[[ -s "/home/username/.rvm/scripts/rvm" ]] && source "/home/username/.rvm/scripts/rvm" # This loads RVM into a shell session.
I guess it is always a good idea to take a look at the latest release notes.
Also I found the "How to use RVM" screencast very helpful! It also includes information about your question in the first minutes.
First of all, I'm running bash 3.2.48 on mac osx 10.7.1 with xCode 4 installed.
I've downloaded RVM like specified in the official documentation but when I do
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
I get an error
-bash: /Users/kevin/.rvm/scripts/rvm: line 28: syntax error near unexpected token `done'
-bash: /Users/kevin/.rvm/scripts/rvm: line 28: ` done'
I've searched either on Google, the rvm github issue tracker and stackoverflow but I didn't get any info on similar issue or anything that helped me find a solution.
Nobody seems to have trouble like this installing RVM 1.8.3 so I guess something is going wrong when I install on my mac.
Here's the corresponding part of the script.
#!/usr/bin/env bash
# rvm : Ruby enVironment Manager
# https://rvm.beginrescueend.com
# https://github.com/wayneeseguin/rvm
# Is RVM loaded as a shell function already?
export HOME="${HOME%%+(\/)}" # Remove trailing slashes if they exist on HOME
if (( ${rvm_ignore_rvmrc:=0} == 0 ))
then
for rvmrc in /etc/rvmrc "$HOME/.rvmrc"
do
if [[ -f "$rvmrc" ]]
then
if \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
printf "\nError:
$rvmrc is for rvm settings only.
rvm CLI may NOT be called from within $rvmrc.
Skipping the loading of $rvmrc"
return 1
else
source "$rvmrc"
fi
fi
done
fi
The error triggers on done just before the last if
Any help would be greatly appreciated.
EDIT: I found the problem, I mispelled an alias as fi. I just renamed it and it worked.
Thank you for your help. Sorry for this useless question.
I believe you're not supposed to type that but rather add it to your ~/.bash_profile at least that's how I did it on linux before, could you point where are you reading the steps for installation from?
That is correct, thats not for running at the commandline, that goes in your .bash_profile or .bashrc (with a corresponding
if [ -f "$HOME/.bashrc" ]; then
source $HOME/.bashrc
fi
in your .bash_profile)
So I decided to switch to zsh for a few reasons and it worked without doing anything but putting the line into the zshrc. But I will try to find the problem anyway.
I saw some questions like this already, but it seems that system-wide RVM has been deprecated, so none of the answers apply.
I have an NFS-mounted home directory which is accessible to me when I login to any number of different machines in our lab. As such, a locally-compiled Ruby will break when I try to use it on these different machines -- as they have different architectures.
I installed RVM as superuser, but I can't figure out how to direct my regular user account to use the superuser-selected Ruby. Instead it always tries to use the one in ~/bin.
What is the appropriate way to select the global Ruby?
I struggled with this same issue for quite a while. I ended up doing the following:
Install rvm with the following command line (note: the --path option is not mentioned in the usage, so I don't know how supported it is, but it worked for me), with the appropriate architecture in the path:
rvm-installer --path ~/tools/x86_64/rvm --version latest
Install for whatever architectures you want to be able to support. (note: make sure you don't have a .rvmrc file overriding the path, especially during the second install.)
Then add the following to your .bashrc/.bash_profile:
OS=$(uname -s)
if [[ $OS = Linux ]] ; then
> ARCH=$(uname -m | sed 's/i.86/i686/')
elif [[ $OS = FreeBSD ]] ; then
> ARCH=$(uname -m | sed 's/i.86/i686/')
elif [[ $OS = Darwin ]] ; then
> ARCH=mac
else
> ARCH=unknown
fi
export ARCH
There will be a line added by the installer in your .bash_profile that sets up the rvm function, change it to look like this:
[[ -s "$HOME/tools/$ARCH/rvm/scripts/rvm" ]] && . "$HOME/tools/$ARCH/rvm/scripts/rvm"
You should also edit your .rvmrc file to have the following:
export rvm_path="$HOME/tools/$ARCH/rvm"
I haven't had time to fully test out this setup, but at least it appears to be invoking the correct version of RVM on the different platforms.
Good luck!
Can someone please translate this into manageable steps I need to take:
~ Wayne
You must now finish the install manually:
1) Place the folowing line at the end of your shell's loading files(.bashrc or .bash_profile for bash and .zshrc for zsh), after all path/variable settings:
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
Please note that this must only occur once - so, you only need to add it the first time you install rvm.
2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly).
This means that if you see '[ -z ] && return' then you must change this line to:
if [[ ! -z ]] ; then
... original content that was below the && return line ...
fi # <= be sure to close the if.
#EOF .bashrc
Be absolutely *sure* to REMOVE the '&& return'.
If you wish to DRY up your config you can 'source ~/.bashrc' at the bottom of your .bash_profile.
placing all non-interactive items in the .bashrc, including the 'source' line above
3) Then CLOSE THIS SHELL and open a new one in order to use rvm.
[ -z "$PS1" ] && return
WARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc.
This means that if you see '[ -z $PS1 ] && return' then you must change this line to:
if [[ -n $PS1 ]] ; then
... original content that was below the && return line ...
fi # <= be sure to close the if.
#EOF .bashrc
Even if you use zsh you should still adjust the .bashrc as above.
If you have any questions about this please visit #rvm on irc.freenode.net.
Installation of RVM to /home/kapplej/.rvm/ is complete.
I'm a complete newbie, so I am not even sure which one is shell's loading file, and how do I edit it?
I found out how to do this, hope this saves someone time:
to install RVM, enter the following in your terminal:
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
once you install rvm,
depending on which text editor you are using, I am using mate, so I typed in:
mate .bashrc
then once your text editor window opens up, copy and paste this line into it:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
now save and close that window.
then repeat for:
mate .bash_profile
close that terminal and restart a new terminal
type in:
rvm use 1.9.1 (or 1.9.2)
then type in:
ruby -v
and you should see ruby1.9.1
to get back to default, type:
rvm default
now you should get ruby 1.8.6 (or 1.8.7 depending on your default).
I was having trouble with this same step from the RVM website:
The first time you install RVM, you must put the following line into your profile at the very end, after all path loads etc: [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Finally got it working after inserting that line into the .profile file, .bash_profile, and .bashrc files in the home directory of my user on OS X.
It seems like all of these are not necessary. Since the RVM website only says "put the following line into your profile" it's sort of misleading to a noob like me that doesn't really know what my profile is.
Can someone tell me which of these files (profile file, .bash_profile, and .bashrc files) that I can remove that line from?