Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setenv equivalent on mac?

Tags:

bash

macos

setenv

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!

like image 458
user1871869 Avatar asked Sep 24 '13 18:09

user1871869


2 Answers

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

like image 176
Doon Avatar answered Sep 20 '22 09:09

Doon


Best for Mac is:

launchctl setenv NODE_ENV localhost

if you want to make the variable persistent and avoid rebooting.

See:

http://www.dowdandassociates.com/blog/content/howto-set-an-environment-variable-in-mac-os-x-slash-etc-slash-launchd-dot-conf/

like image 45
German Avatar answered Sep 18 '22 09:09

German