Mountain Lion: how set environment variables

Am I correct that for Mountain Lion, if not earlier, the only way to set environment variables at the system level is to use (or create) a file /etc/launchd.conf that contains commands such as:
setenv CATALINA_BASE /opt/local/share/java/tomcat6
(That does seem to work as expected.)
If so, how does one do this by referencing the value of something else, e.g., to set JAVA_HOME? I tried
setenv JAVA_HOME $(/usr/libexec/java_home)
but then in Terminal if I run
echo $JAVA_HOME
I just get back $(/usr/libexec/java_home).
By contrast, if I put that same setenv JAVA_HOME $(/usr/libexec/java_home) command into my ~/.profile, then the result of echo $JAVA_HOME is the actual value referenced, namely, /Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home.

Linc Davis wrote:
launchd is not a shell and does not peform expansion. You have to use literal expressions. But you can also modify the bash environment system-wide by editing the file /etc/profile.
But sudo emacs /etc/profile won't let me edit this file: it's read-protected, emacs says.
What permissions should I give it? Right now it's in group wheel, owned by root but with Read permission only.
P.S. And is it really a good idea to edit /etc/profile -- assuming I can suitably set the permissions to do so? Apple goes out of its way to try to hide this file: /etc is a link to /private/etc, e.g.

Similar Messages

  • How to set environment variables in WL ?

    Hi,
    How to set environment variables in WL ?
    Thanks,
    Srivi

    Hi,
    You can set the environmet variable in Weblogic by using the below commands
    setWLSEnv.cmd/sh ==>Set the CLASSPATH to include the WebLogic Server classes.
    Overview of WebLogic Server Domains
    or you can use to set the Environment variable along with domain specific varables using the SetDomainEnv.cmd
    To run SetDomainEnv.sh in Linux please use
    . ./setDomainEnv.sh it require two dots (Dont miss it )
    http://docs.oracle.com/cd/E28280_01/web.1111/e13749/weblogicserver.htm#ADMRF205
    Hope it helps

  • How to set environment variable ORACLE_HOME ?

    Hi
    I trying to install SAP Solution manager 4.0 SR3:
    OS: Linux RHEL4u4
    DB: Oracle
    SAPinst now stops the installation.
    To proceed with the installation, install the Oracle database as follows:
    1.Log in as user orassm.
    2.Set the DISPLAY variable.
    3.Change to directory /oracle/stage/102_32/database/SAP.
    4.Start './RUNINSTALLER'.
    After you installed the Oracle database software, proceed with the database instance
    installation by choosing 'OK' in this dialog box.
    ./RUNINSTALLER
    oracle_stage is not set (OK)
    oracle_base is not set (OK)
    oracle_home is not set (OK)
    oracle_sid is not set (OK)
    oracle_home_name is not set (OK)
    oracle_inst_group is not set (OK)
    from_location is not set (OK)
    tmp_netca_file is not set (OK)
    tmp_dbca_file is not set (OK)
    Working in /oracle/stage/102_32/database/SAP ...
    The environment variable ORACLE_HOME is not set! abort ...
    How to set environment variable ORACLE_HOME ?
    Regards
    Eric

    i
    Switch shell to bash:
    orassm:x:502:503:SAP Database Administrator:/oracle/SSM:/bin/bash
    [root@csp-p-sm00 ~]# su - orassm
    [orassm@csp-p-sm00 ~]$
    But when try to run ./RUNINSTALL
    [orassm@csp-p-sm00 SAP]$ ./RUNINSTALLER
    oracle_stage is not set (OK)
    oracle_base is not set (OK)
    oracle_home is not set (OK)
    oracle_sid is not set (OK)
    oracle_home_name is not set (OK)
    oracle_inst_group is not set (OK)
    from_location is not set (OK)
    tmp_netca_file is not set (OK)
    tmp_dbca_file is not set (OK)
    Working in /oracle/stage/102_32/database/SAP ...
    The environment variable ORACLE_HOME is not set! abort ...
    Additionaly I've post csh.cshrc and csh.login
    /etc/cshrc
    csh configuration for all shell invocations.
    by default, we want this to get set.
    Even for non-interactive, non-login shells.
    [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]
    if $status then
            umask 022
    else
            umask 002
    endif
    if ($?prompt) then
      if ($?tcsh) then
        set prompt='[%n@%m %c]$ '
      else
        set prompt=\[`id -nu`@`hostname -s`\]\$\
      endif
    endif
    if ( $?tcsh ) then
            bindkey "^[[3~" delete-char
    endif
    setenv MAIL "/var/spool/mail/$USER"
    limit coredumpsize 0
    if ( -d /etc/profile.d ) then
            set nonomatch
            foreach i ( /etc/profile.d/*.csh )
                    if ( -r $i ) then
                            source $i
                    endif
            end
            unset i nonomatch
    endif
    /etc/csh.login
    System wide environment and startup programs, for login setup
    if ($?PATH) then
            if ( "$" !~ /usr/X11R6/bin ) then
                    setenv PATH "$:/usr/X11R6/bin"
            endif
    else
            if ( $uid == 0 ) then
                    setenv PATH "/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"
            else
                    setenv PATH "/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"
            endif
    endif
    setenv HOSTNAME `/bin/hostname`
    set history=1000
    if ( ! -f $HOME/.inputrc ) then
            setenv INPUTRC /etc/inputrc
    endif
    Regards
    Eric

  • How to set environment variables using java program

    Hi all
    I want to set environment variables on windows 98/200/xp system, such as path and classpath using a java program.
    How to do this using a java program.
    Any body plz helppppppppp.

    #1 05-02-2003, 07:38 AM
    Goodz13 Join Date: Jan 2002, Posts: 985
    Location: Halifax, NS, Canada
    Reputation:
    Java FAQ's and tutorials
    Java FAQ's
    Path and ClassPath:
    PATH
    In Windows 9x you would set it up in the autoexec.bat file
    ie.
    SET PATH=%PATH%;c:\jdk1.4.2\bin\;
    where c:\jdk1.4.2\ is the path where you installed Java.
    In Windows 2000 and XP
    Right click on My Computer->Properties->Advanced Tab->Environment Variables... Button.
    If you see a PATH in System Variables, click that and edit it. If you don't, you will need to create a new System variable.
    It should look something like this:
    %SystemRoot%\system32;%SystemRoot%;c:\jdk1.4.2\bin\;
    Any querry email me to [email protected]
    Answer by
    Rajasekhar Goli
    DS UNICS Infotech

  • In Mountain Lion how does OS select between ethernet and WiFi when both are activated??

    In Mountain Lion how does OS select between ethernet and WiFi when both are activated??  How does OS use "both" networl accesses??

    It will pick the highest service in the list which has an internet connection.
    To order the list, open Network System Preferences and select Set order of network services from the button below the service list.

  • Forget to set environment variable export SAPINST_USE_HOSTNAME

    Dear Experts
    we have installed the SAP ECC6.0 EhP4 in HACMP environment with AIX6.1 ,Power HA cluster6.1, oracle 11g database
    the problem is while installing the CI and ASCS and Dialog instance I  missed  to set environment variable
    export SAPINST_USE_HOSTNAME = <virtual Host Name> and while starting the sap-inst also i didn't start as like
    ./sapint SAPINST_USE_HOSTNAME  = <virtual Host Name>,Now i am facing problem while doing cluster fail over to another node
    Node A host Name is not reflecting in Node B and I am not able to start  the SAP with host name of Node A
    in AIX6.1 in IBM Admin they didnt give any virtual host name they said that they  have configured  the cluster with two service IP there is no virtual IP in AIX6.1
      please help me out how to resolve this host Name issue and to start the SAP in Node B
    Thanks in Advance
    krishna

    Hi Krishna,
    I dont agree with the AIX 6.1 having no virtual ip's, because i recently installed a HA instance with ASCS, SCS & also ERS on 6.1
    to answer your questions:-
    "can you tell is this correct setup or anything we did mistake for file system setup and installation"
    This depends on what your requirement is. Typically a cluster will have Oracle on one host and SAP on the other host. Ill explain the VCS concept, so you will have a better understanding.
    Lets consider Node1 & Node2. Now each node will have a physical IP and a virtual IP. The Virtual IP will be associated with a set of file systems. For example /oracle will be associated to virtual ip lets say "xyzDB" & the /usr/sap/<sid>, TRANS & sap mount will be associated with virtual ip lets say "abcCI". Now when the cluster fails over to which ever node, these file systems will still be associated with their respective virtual ip's.
    So, the start profile will always have START_DVEBMGS_abcCI. Irrespective of which Node the sap is in, when you start the SAP, it will use the virtual hostname and start up SAP. I hope your getting the concept.?
    Coming back to the setup, since you have ASCS, Oracle , CI & a dialog instance. Im not sure what file systems you have associated with VCS groups. Can you give command "hastatus -sum" and post the output?
    Regarding your other question
    "this file system is moving to Node B but while starting SAP on Node B host Name is not reflecting and SAP is not coming up  due to there hostname didnt change in Node B,, can you advice me please ,,"
    This is inline with what i explained above for cluster mechanism. The physical IP will not change. It is only the virtual IP that is associated with a set of file systems.
    Ill give you one more example, Consider the parameter rdisp/mshost = <> . What should this be? Physical host or Virtual host?? :-) .It should be Virtual. Because the CI can be in Node1 or Node2. If we give the physical host, then if the SAP fails over to the other node. How will it start up? because the profiles still say the message server is in the other host... Getting my point?
    Regards,
    Shanser

  • In Mountain Lion, how do I find the location of an open Preview File?  The file "properties" tab is no longer available.

    I typically have several open Preview files at any one time and often forget where, sometimes if, I saved them.  In Mountain Lion, how do I find the location of an open Preview File?  Tried holding option + command in spotlight but I don't see a path name appear anywhere. 

    Yes, cmd-option on a file you choose in Spotlight and the path will appear at the bottom of the Preview window.
    EDIT: Also, if it is bookmarked the path is in Bookmarks.

  • I have an older iMac running on 10.5.8 and need to update to mountain lion how do i go about it?

    I have an older iMac running 10.5.8 and need to update to mountain lion, how do I go about it?

    Welcome to the Apple Support Communities
    Check if your computer is compatible with Snow Leopard > http://support.apple.com/kb/sp575 If it's supported, cal Apple to buy Snow Leopard > http://support.apple.com/kb/HE57 Then, make a backup, insert the DVD and upgrade. Finally, open Apple menu > Software Update and install the latest version.
    Check if your Mac is supported > http://www.apple.com/osx/specs If it's supported, open App Store and purchase OS X. Check if your programs are compatible > http://www.roaringapps.com

  • I am running Mac OS X 10.5.8 on a macbook and would like to get mountain lion how do i do this?

    i am running Mac OS X 10.5.8 on a macbook and would like to get mountain lion how do i do this?

    Phone the Apple Store, order a Mac OS X 10.6 DVD, run Software Update, and get Mountain Lion from the Mac App Store.
    (68358)

  • I am running Snow Leopard 10.6.8 with bootcamp 3.3 on my Imac 2011. I need to updgrade to mountain lion. If I first upgrade to mountain lion, how do I go about upgrading from bootcamp 3.3 to latest bootcamp for mountain lion?

    I am running Snow Leopard 10.6.8 with bootcamp 3.3 on my Imac 2011. I need to updgrade to mountain lion. If I first upgrade to mountain lion, how do I go about upgrading from bootcamp 3.3 to latest bootcamp for mountain lion?
    I have seen a lot of discussions upgrading from Boot Camp 4 to 5 but no answers upgrading from boot camp 3.3 to 5. My worry is that if I upgrade from snow leopard to mountain lion, that my bootcamp partition will no longer be able to boot up. There seem to be a lot of threads suggesting problems that are possible. Has anyone gone through this upgrade with success?

    Before doing any installation restart OSX from your 10.6 Snow Leopard DVD and use Disk Utility to Both Repair The Disk and Repair the Permissions of your Macintosh HD.
    Next remove your Snow Leopard DVD and restart your iMac into OSX.
    Update to the latest version of OS X Snow Leopard by clicking the Apple icon and choose Software Update to install Snow Leopard v10.6.8, the latest version.
    Use Time Machine to make a Full Backup of your Macintosh HD.
    Shut down and restart into Windows by holding the Option key at the chime and selecting Windows.
    Now use Windows Backup to make a Full Image Backup of your Windows Installation to a removable drive.
    Shut Down and Boot back into OSX.
    Open the Mac App Store from your Dock to buy and download Mountain Lion. Then follow the onscreen instructions to install it.
    Upgrading your OSX to 10.8 should not effect the Windows Partition at all since you are only upgrading the Mac side. You should not have to run the Boot Camp Assitant 5 Utility in OSX at all.
    Your Boot Camp 3.3 Windows Support Drivers et. al only effect your Windows installation and should continue to run fine after upgrading.
    Which version of Windows do you already have installed on the existing Boot Camp Partition?
    Is it 32 bit or 64 bit?

  • My messages broken in Mountain Lion, how to reinstall ?

    My messages broken in Mountain Lion, how to reinstall ?
    i browsed have MessageBeta.. cannot install in ML.. how i can reinstall ?
    Please help me.. thx

    HI,
    If you have any sort of Back up such as a Time Machine one you could "restore" it to the Applications folder if you know which date it last worked.
    Other than that it is the Mountain Lion Restore process (Restart the Computer holding CMD and R)
    9:57 PM      Sunday; September 23, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and and iPad
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • HT1338 I need to update my old osx 10.5 to the osx mountain lion how do I do this?

    I need to update my old osx 10.5 to the osx mountain lion how do I do this?

    Click here and read all three steps to the bottom.
    (78064)

  • HT1338 I am on OS X 10.5.8 and I would like to get snow leopard or mountain lion, how do I go about upgrading to on of these?

    I am on OS X 10.5.8 and I would like to get snow leopard or mountain lion, how do I go about upgrading to on of these?

    You phone the Apple Store and order a Mac OS X 10.6 DVD, and if desired, update it to 10.6.8 and get Mountain Lion from the Mac App Store.
    (68248)

  • ISync disappear in the iOS Mountain Lion, how can I synchronize my mobile Nokia?

    iSync disappear in the iOS Mountain Lion, how can I synchronize my mobile Nokia?

    Mountain Lion is not iOS. It is OS 10.8. iOS is for iPhone, iPad, iPod. That said read:
    http://discussions.nokia.com/t5/PC-and-Mac-Software/How-to-sync-with-Mac-in-OS-X -10-7-Lion/td-p/1087815/page/2

  • I keep getting "an error occurred when installing, please run program again" for OS X mountain lion, how can i fix the problem?

    i keep getting "an error occurred when installing, please run program again" for OS X mountain lion, how can i fix the problem?

    The Reset feature adds a folder on your desktop named Old Firefox Data. I recommend hanging onto that for a few weeks in case you discover something essential that the Reset feature left behind.
    This article has a list of what is migrated and what is not during a Reset, in case you're curious: [[Reset Firefox – easily fix most problems]].

Maybe you are looking for

  • Freezing, display issues, and now... wont start up in OSX

    Increasingly becoming an object i'd like to throw out the window, my mac book pro has now added a new trick to it's bag. originally, it was just doing silly things to the screen: when i scroll on web pages the page would move and some of the text wou

  • ReadLine() in java.io.DataInputStream has been deprecated

    Hi, I am using the following code : File f=new File(filePath);                FileInputStream fis=new FileInputStream(f);                BufferedInputStream bis = new BufferedInputStream(fis); dis = new DataInputStream(bis);                while((rec

  • Best setting for web?

    I am trying to load a picture up to the web and the ones I have loaded have poor resolution. can someone please give me suggestions on what setting I should use from I-PHOTO for the best resolution. Thanks JIm

  • Program rmi using jbuilder

    hello i write a simple rmi program(hello world),i can write and compile the hello interface and its implementation in jbuilder,but how can i use the jbuilder to generate the stub and the skeleton instead of using "rmic" command in the dos windows?i w

  • Quicklook (jpg) is not working in iPad Air

    Quicklook (jpg) is not working in iPad Air; only option is airdrop or sharing/opening in the apps - Flickr, Dropbox, PS, etc.