Skip to content

Instantly share code, notes, and snippets.

@cre-o
Last active February 13, 2016 05:20
Show Gist options
  • Save cre-o/4535005 to your computer and use it in GitHub Desktop.
Save cre-o/4535005 to your computer and use it in GitHub Desktop.
Whenever "/usr/bin/env: ruby: No such file or directory" fix
> Tested on ubuntu 12.04 if rvm installed for single user
$ echo $PATH # Since cron doesn't have user's local environment, we need to specify it
$ echo $GEM_PATH # Copy this output to
# Modify schedule.rb with your new PATH's
# It should be like this one (add it to the top)
env :PATH, '/home/home_user/.rvm/gems/ruby-1.9.3-head/bin:/home/home_user/.rvm/gems/ruby-1.9.3-head@global/bin:/home/home_user/.rvm/rubies/ruby-1.9.3-head/bin:/home/home_user/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/home_user/.rvm/bin'
env :GEM_PATH, '/home/home_user/.rvm/gems/ruby-1.9.3-head@gemset:/home/home_user/.rvm/gems/ruby-1.9.3-head@global'
# Now update you crontab file
$ bundle exec whenever -s "environment=production" --update
$ crontab -l # At the top, you will see PATH and GEM_PATH
# You've done
@Revokee
Copy link

Revokee commented May 11, 2015

Perfect!! Thanks for sharing!

@Manre
Copy link

Manre commented Oct 3, 2015

Thanks for sharing! it worked!

@SuperMasterBlasterLaser

please add also example for rbenv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment