export RAILS_ENV=productionwhich will last until your exit your shell (log out), or prepend
RAILS_ENV=productionto the command you're trying to run, e.g.:
RAILS_ENV=production rake about
I personally use a .rbenv-vars file in the root of each Rails project.
There you can set all your project specific env vars and they’re going to be automatically loaded by rbenv.