setenv equivalent on mac?

user1871869 picture user1871869 · Sep 24, 2013 · Viewed 35.1k times · Source

I want to set an environment variable using setenv:

setenv NODE_ENV localhost  

But setenv gives me an error saying the command is not found. Does anyone know how to perform the MAC OSX equivalent of setenv? Thanks!

Answer

Doon picture Doon · Sep 24, 2013

you want export

NODE_ENV=localhost
export NODE_ENV

or on 1 line export NODE_ENV=localhost

and this has nothing to do with OSX per se, more to do with bash vs (t)csh as your shell