Anyone have idea how to fix this one. i almost try everything here.
after i type brew doctor here the error
Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
phar
phar.phar
php
php-config
phpize
Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile
and here my ~/.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*
echo $PATH /usr/local/bin:/usr/local/sbin:/Users/ericsonluciano/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
export PATH=/usr/local/bin:/Users/ericsonluciano/.rvm/gems/ruby-2.1.2#rails4.1/bin:/Users/ericsonluciano/.rvm/gems/ruby-2.1.2#global/bin:/Users/ericsonluciano/.rvm/rubies/ruby-2.1.2/bin:/usr/bin:/bin$
export PATH=/usr/local/bin:$PATH
Thanks everyone for help :)
The right thing to do is to do any path settings inside a configuration file that is sourced by both non-interactive and interactive shells.
Likely you have code in your ˜/.bashrc (meant for only interactive settings) mucking with your path.
See this answer https://stackoverflow.com/a/27191389/766289 and just use bash in place of zsh.
Related
I am installing Yarn. In guide, it asks to set up PATH environment variable.
But in my .profile, it already has rvm PATH.
How to set up PATH correctly???
Just paste, export PATH="$PATH:$HOME/.yarn/bin", at the end of the file???
Change, export PATH="$PATH:$HOME/.rvm/bin" into export PATH="$PATH:$HOME/.rvm/bin:$HOME/.yarn/bin"???
You just need to add the line export PATH="$PATH:$HOME/.yarn/bin" to the end of your .profile file. I.e. the final result should look like this
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM$
export PATH="$PATH:$HOME/.yarn/bin"
You will want to go with your second option and use:
export PATH=$PATH:$HOME/.yarn/bin:$HOME/.rvm/bin
Otherwise, your $PATH variable will no longer reference the .rvm directory, leading to issues with your Ruby installation.
Alternatively, you can add it below the current line such as:
export PATH=$PATH:$HOME/.rvm/bin
export PATH=$PATH:$HOME/.yarn/bin
This has the same effect.
I have a rails application in /home/myuser/watchDir/myapp and an incron job set to watch the ../watchDir for modification. Once triggered, incron will run a script, /usr/local/bin/myscript.sh. This is the only place I could get incron to run a script from. In that script I have calls to run rake and bundle commands in my root app. I The script IS being run (I have a test for that) but the bundle and rake commands both fail silently. I am fairly new to linux and internet research has given some solutions. I have all absolute paths in my scripts. I tried adding my bash_profile to the scripts/incron commands. I tried having the incron script run another script located in my home directory. All the scripts are executable. I tried using the --gemfile option for bundle but that doesn't wokr. Does anyone know what I have to do here? Basically, I want to run the bundle and rake commands outside of RAILS_ROOT. I also would like to know if incron complicates the use of the rails commands. Thanks.
EDIT:
Here are the relevant files:
Incrontab:
/home/myuser/watchDir/ IN_MODIFY,IN_CLOSE_WRITE,IN_CLOSE_NOWRITE /bin/bash /usr/local/bin/runT.sh $#/$#
I also tried this:
/home/myuser/watchDir/ IN_MODIFY,IN_CLOSE,IN_CLOSE_WRITE,IN_CLOSE_NOWRITE source '/home/myuser/.bash_profile && /bin/sh /usr/local/bin/runT.sh' $#/$#
And here's the script it's calling:
#!/bin/bash
mkdir /home/myuser/worked #This is to ensure that that incron is running and executing this script
cd /home/myuser/watchDir/myapp
/home/myuser/.rvm/gems/ruby-1.9.3-p545/bin/bundle install --gemfile /home/myuser/watchDir/myApp/Gemfile
/home/myuser/.rvm/gems/ruby-1.9.3-p545/bin/rake -f /home/myUser/watchDir/myApp
My .bash_profile file:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
source ~/.profile
To sum up my last comments ... change your icrontab entry to be:
/home/myuser/watchDir/ IN_MODIFY,IN_CLOSE_WRITE,IN_CLOSE_NOWRITE /bin/bash /usr/local/bin/runT.sh $#/$#
And the script to be:
#!/bin/bash
source /home/myuser/.bash_profile
mkdir /home/myuser/worked #This is to ensure that that incron is running and executing this script
cd /home/myuser/watchDir/myapp
/home/myuser/.rvm/gems/ruby-1.9.3-p545/bin/bundle install --gemfile /home/myuser/watchDir/myApp/Gemfile
#/home/myuser/.rvm/gems/ruby-1.9.3-p545/bin/rake -f /home/myUser/watchDir/myApp
I'm using Homebrew on Mac OS X 10.8.3. Homebrew wants the /usr/local/bin directory earlier in the PATH than /usr/bin, otherwise system-provided programs will be used instead of Homebrew managed replacements.
I'm using zsh, and in my .zshenv I reset the PATH, and then use path_helper to initialize it, like so:
if [ -x /usr/libexec/path_helper ]; then
PATH=''
eval `/usr/libexec/path_helper -s`
fi
Immediately following this, also in .zshenv, I prepend /usr/local/bin to the PATH.
export PATH="/usr/local/bin:$PATH"
There are various other additions to $PATH. RVM, /usr/local/sbin and my personal bin directory:
export PATH=$HOME/.rvm/bin :$PATH
...
export PATH=$PATH:/usr/local/sbin:$HOME/bin
Finally, I use typeset -u to remove any duplicates (although where they are coming from is a mystery to me) from the PATH.
typeset -U PATH
After all of this here is what my PATH looks like:
/Users/mark/.rvm/gems/ruby-1.9.3-p374/bin
/Users/mark/.rvm/gems/ruby-1.9.3-p374#global/bin
/Users/mark/.rvm/rubies/ruby-1.9.3-p374/bin
/Users/mark/.rvm/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/usr/local/sbin
/Users/mark/bin
I know that /etc/paths sets these paths:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
so I edited that file and removed the /usr/local/bin' option so that the only place it is being set is in.zshenv`.
All of this is contained in my dotfile repository on GitHub (https://github.com/zan5hin/dotfiles), and is being used on two laptops. On the first laptop the path is correct, with /usr/local/bin immediately following the RVM entries. On the second laptop it appears as I detailed above.
I am at a loss to explain why the path is incorrect on the second machine when the zsh configuration is an identical copy.
Can anyone suggest why the path would be out of order?
Thanks.
zsh reads the files in the following order (from man 1 zsh)
$ZDOTDIR/.zshenv
/etc/zprofile (if login)
$ZDOTDIR/.zprofile (if login)
/etc/zshrc (if interactive)
$ZDOTDIR/.zshrc (if interactive)
/etc/zlogin (if login)
$ZDOTDIR/.zlogin (if login)
If ZDOTDIR is unset, HOME is used instead. Files listed above as being in /etc may be in another directory, depending on the installation.
Your changes were to (1) which is before (2); the macOS default for (2) is:
% cat /etc/zprofile
# System-wide profile for interactive zsh(1) login shells.
# Setup user specific overrides for this in ~/.zprofile. See zshbuiltins(1)
# and zshoptions(1) for more details.
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
thus, your changes are being overridden by the macOS default. You will need to make your PATH changes later in the pipeline in order to preserve order.
This line is wrong:
export PATH=$HOME/.rvm/bin :$PATH
It should be:
export PATH=$HOME/.rvm/bin:$PATH
The space before :$PATH is causing you to lose the previous contents of $PATH.
I am installing rvm on Ubuntu Server 11.10 following the excellent guid: http://blog.ninjahideout.com/posts/a-guide-to-a-nginx-passenger-and-rvm-server
Since the link is broken in the article, I use the script from RVM Homepage to install the rvm for multiple users:
sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
As per the blog post by Darcy, after the installation, /usr/local/lib/rvm will be created:
/usr/local/lib/rvm – a simple shell script to intelligently load rvm.
But I could not find it in my system, and also I could not find any example of this file from google to create by myself, would you help me why it is working as described in my system? How could I fix it?
It is located in ~/.rvm/bin/rvm
Exctracted from the install script
if [[ -z "${rvm_path:-}" ]]
then
if (( UID == 0 ))
then
rvm_path="/usr/local/rvm"
else
rvm_path="${HOME}/.rvm"
fi
fi
export HOME rvm_path
I was trying to switch to zsh and oh-my-zsh console for RubyonRails projects. However after installing and appending "[[ -s "$HOME/.rvm/scripts/rvm" ]] && . “$HOME/.rvm/scripts/rvm”" to .zshrc, I am getting the error as
/home/pratuat/.zshrc:33: no such file or directory: “/home/pratuat/.rvm/scripts/rvm”
➜ ~ cd /home/pratuat/.rvm/scripts
➜ scripts ls
alias disk-usage help migrate rvm
aliases docs hook monitor rvm-install
array env info notes selector
base environment-convertor initialize override_gem set
cd extract install package snapshot
cleanup extras irbrc patches tools
cli fetch irbrc.rb patchsets update
color functions list pkg upgrade
completion gemsets maglev repair version
current get manage requirements wrapper
db group match rtfm zsh
default hash md5 rubygems
permissions to the rvm file is ok, but ~/.zshrc is still not getting it
carefully inspect [[ -s "$HOME/.rvm/scripts/rvm" ]] && . “$HOME/.rvm/scripts/rvm" statement. You may copy this from others' blog post. If you are on mac,try to replace "." with "source", sometimes this will work.
The actual problem is with the quotes in “$HOME/.rvm/scripts/rvm”
Try replacing your line with the one below and it might work
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
Note that there is a difference between “” and "".