I followed this similar question to set my environment variables in Yosemite: https://stackoverflow.com/questions/25385934/setting-environment-variables-via-launchd-conf-no-longer-works-in-os-x-yosemite/26179907#26179907
I want to do the same thing, but for sudo
do shell script "sudo launchctl setenv variablename value" with administrator privileges
but somehow, it does not show if I go in a terminal afterwards and run the command:
sudo launchctl getenv variablename
What am I doing wrong ?
Best Answer
Your first line of code is wrong. If you say
sudo
andwith administrator privileges
you are doing the same thing twice. If you use the terminal, as you can see, the following works:You could unset the variable with the command:
You don't need an applescript to do that.