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!
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!
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
Best for Mac is:
launchctl setenv NODE_ENV localhost
if you want to make the variable persistent and avoid rebooting.
See:
launchctl
relevant? –
Pellikka setenv
command the OP was asking about is the builtin command in [t]csh. export NODE_ENV=localhost
in bash, is exactly equivalent to setenv NODE_ENV localhost
in [t]csh. The OP doesn't appear to have been asking how to make the setting persistent; that would be a separate question. Is there some obvious connection between node.js and launchctl
? –
Pellikka Are you a Cshell person?
The earlier versions of OS X came with tcsh
as the default shell since OS X is based upon BSD. However, Mac OS X comes with BASH as the user's default shell.
Macs still come with Turbo Csh too and you can make this your default shell if that is your desire. In the terminal, type:
$ chsh -s /bin/tcsh
If you decide you want switch back to BASH:
$ chsh -s /bin/bash
You can see a list of all possible shells in the /etc/shell
file.
© 2022 - 2024 — McMap. All rights reserved.