Ruby PATH is not correctly set up

2019-07-02 01:03发布

问题:

OK so I had Ruby working perfectly to use guard to watch some sass files, I restarted my computer, apple did some updates (no idea if this is related to the problem or not). Once it had rebooted, I went to switch guard back on, and I get this error:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb:212: warning: Insecure world writable dir /usr/local/ImageMagick/bin in PATH, mode 040757

Now the one thing that is pretty obvious is the 'Imagemagick' in the middle of my path, I have no idea how that got there, and fairly sure thats my problem.

When I try and run most things in Ruby I get this :

PATH is not properly set up, '/usr/local/rvm/gems/ruby-1.9.3-p448/bin' is not available,
     usually this is caused by shell initialization files - check them for 'PATH=...' entries,
     it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
     to fix temporarily in this shell session run: 'rvm use ruby-1.9.3-p448'.

rvm get stable --auto-dotfiles doesnt seem to do anything for me. Running rvm info gives me this for the path:

    PATH:         "/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/ImageMagick/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin:/usr/local/rvm/bin"

Just want to know how I can fix this path or anything that will sort my problems, I feel like I've been going round in circles for too long now.

Thanks

回答1:

I had the same issue on OSX Mavericks. The solution that worked for me was to add the rvm path to the PATH environment variable in ~/.bash_profile file. In my case, I did not have a system wide installation of rvm, so the following entry worked for me.

PATH=/usr/local/bin:$HOME/.rvm/bin:$PATH


回答2:

there is something resetting the PATH set by rvm, search your shell initialization files for PATH= not containing $PATH.



标签: ruby rvm