How to set the PATH in Terminal?

As a newbie to Bash and the Terminal, in connection with installing a new version of Ruby and various add-ons, I have been messing around with changing the PATH via various methods I've found on the internet, and trying to add a new directory to my PATH. Unfortunately, I cannot figure out how to set the PATH correctly. Here is what I understand so far:
1. Bash first looks to ".bash_profile" in the home directory for PATH settings.
2. If none, Bash then looks to ".bash_login" for PATH settings.
3. If none, Bash then looks to ".profile".
4. If none, Bash then looks to a system file in "/etc/profile" for default PATH settings.
5. For a new shell after login, Bash looks for a ".bashrc" file.
I cannot find any of the above files (I have Finder set to show hidden files already). Somehow, following some instructions from the internet without really knowing what I was doing over the past week I have set my PATH as follows:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/*****/src:/usr/X11/bin
but I cannot find the file that is setting this PATH. I have tried creating a new ".bash_profile" shell file and putting it in various places such as "/bin" and "/usr/bin" but the file is not being read.
* As a temporary workaround I tried using the command "source .bash_profile" upon login to set the PATH using the .bash_profile file that I created, but it does not work.
* I am able to temporarily alter the path using the command "PATH=/usr/local/bin:$PATH" but this only lasts for an active shell; when I close out and reopen a new shell, it reverts to the default.
So my questions are:
Is it correct that there is a "/etc/profile" somewhere that is setting the default PATH? If so where is it? Should I alter it, or create a new ".bash_profile" somewhere to set the PATH? If not, where is my PATH being set? If I should create a new ".bash_profile", what exactly should go in it?
Thanks in advance for any assistance.

... I created a new ".bash_profile" file directly under my home directory and it worked like a charm. Below is the content of the file:
"PATH=/usr/local/bin:/bin/:/sbin/:/usr/bin/:/usr/sbin/:/Users/******/Ruby:/Users/*******/src:/Users/******/Java Programs/"
What are the "..."'s? Is that just you, or is the contents of the file actually inside of double quotes?
is there an 'export PATH' also in the file? As in
PATH=/usr/local/bin:/bin/:/sbin/:/usr/bin/:/usr/sbin/:/Users/******/Ruby:/Users/*******/src:/Users/******/Java Programs/
export PATH
And did you either restart your Terminal session so your .bash_profile was read, or issue a 'source .bash_profile' command to execute the .bash_profile after your change?
The only remaining problem is that from the home directory, I'm unable to directly run programs in the above-designated subdirectories (without first navigating to the subdirectory containing the file. Is there something wrong with the syntax or order of the directories I put in the path?
For example: there is a file called "newprogram.rb" in the "Ruby" directory listed above. I should be able to execute it from the home directory using "ruby newprogram.rb" but it does not work. The same command works fine from within the "Ruby" directory.
Does the 'ruby' command search PATH to find its scripts?
Have you read the "man ruby" man page to see if it talks about PATH?
A common Unix feature is that programs and scripts with the executable bit set, and are located in a PATH directory, will be run if you just type their names.
For example, if the first line of newprogram.rb script starts with
#!/usr/bin/ruby
and if the script is executable
chmod +x newprogram.rb
And if it is in a directory in PATH, then just typing
newprogram.rb
should run your perl script using /usr/bin/ruby. If you want to use a different version of Ruby, then change the #! line so it point to your version of Ruby. Or if your version of Ruby is found earlier in PATH then the /usr/bin/ruby, you can use
#!/usr/bin/env ruby
as your script's first line which will search PATH for 'ruby' and use the first one it finds.
Message was edited by: BobHarris

Similar Messages

  • How to set the path variable on Windows ME?

    I want to get a friend of mine to start using java the only problem is that we both dont know how to set the path variable in Windows ME. I cant seem to find any instructions on it for ME. So if someone could please tell me how or give me a llnk to directions for Windows ME. Thanks.

    Refer to the Installation Instructions for the package that you installed - I believe #5 if the instructions has the information. A link to the instructions is at the page you installed from.

  • How to set the PATH Environment variable with multiple homes?

    I have several Oracle homes, and now I cannot get reports to work anymore. These are the things I installed, in this order:
    - Oracle Database 10g
    - Oracle Developer Suite 10g
    - Oracle Discoverer 4
    - Oracle HTMLDB
    Now my PATH environment variable is flooded with paths, but none seem to work when I want to start Reports 10g. I deleted all of the paths from the other homes and still no luck.
    This was my original PATH:
    C:\oracle\product\10.1.0\db_1\jre\1.4.2\bin\client;
    C:\oracle\product\10.1.0\db_1\jre\1.4.2\bin;
    C:\oradev10g\jdk\jre\bin\classic;
    C:\oradev10g\jdk\jre\bin;
    C:\oracle\product\10.1.0\compdb_1\jre\1.4.2\bin;
    C:\oracle\product\10.1.0\compdb_1\bin;
    C:\oracle\product\10.1.0\compdb_1\jre\1.1.8\bin;
    C:\oracle\product\10.1.0\compdb_1\jre\1.4.2\bin\client;
    C:\Disco41Home\bin;C:\oracle\product\10.1.0\db_1\bin;
    C:\oradev10g\jdk\jre\bin\client;C:\oradev10g\jlib;
    C:\oradev10g\bin;
    C:\oradev10g\jre\1.4.1\bin;
    C:\oradev10g\jre\1.1.8\bin;
    C:\PROGRAM FILES\THINKPAD\UTILITIES;
    %SystemRoot%\system32;
    %SystemRoot%;
    %SystemRoot%\System32\Wbem;
    C:\WINDOWS\Downloaded Program Files;
    %SystemDrive%\IBMTOOLS\Python22;
    C:\Program Files\PC-Doctor for Windows\services
    and this is the PATH after I stripped it:
    C:\oradev10g\jdk\jre\bin\classic;
    C:\oradev10g\jdk\jre\bin;
    C:\oradev10g\jdk\jre\bin\client;
    C:\oradev10g\jre\1.1.8\bin;
    C:\oradev10g\jlib;
    C:\oradev10g\bin;
    C:\PROGRAM FILES\THINKPAD\UTILITIES;
    %SystemRoot%\system32;
    %SystemRoot%;%SystemRoot%\System32\Wbem;
    C:\WINDOWS\Downloaded Program Files;
    %SystemDrive%\IBMTOOLS\Python22;
    C:\Program Files\PC-Doctor for Windows\services
    What am I supposed to change to get Reports to work again (i.e. do more than just show the splash screen)?
    Forms and Designer work just fine....

    Never mind I found my solution here:
    Re: Oracle Developer hangs when starting...i'm desperate

  • How to set the path for new version of  jdk 1.5.0

    hi
    i downloaded jdk 1.5.0 from sun website . i gave path like this C:\jdk1.5.0\bin; but showing error internal command doent reconiged.give me some instructions aboth this one with details.

    Read item #5 in the Installation Instructions for the file you downloaded.

  • How to set the root path of XML document when calling Inserting procedure

    Hi,
    I was create a procedure to insert XML Document in to DBMS Tables, but i am not able to set the Start root element in calling procedure.
    My calling procedure is
    exec insXmldoc('pmc_sample.xml', 'pmc')
    When i am calling this procedure i got this error
    11:23:54 Error: ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 65
    ORA-06512: at "SCOTT.INSPROC", line 8
    ORA-06512: at line 2
    I am checking my XML file using XML Validator. My XML file was parsed with out errors.
    Please give the solution,and tell me where i did wrong in my calling procedure.
    suppose i have this XML file in local E drive ,how to set the path for that XML file in my calling procedure.

    Hi, I am doing the code likthis,please give the solution.
    SQL> create or replace procedure insProc(xmlDoc IN CLOB, tableName IN VARCHAR2) is
    2 insCtx DBMS_XMLSave.ctxType;
    3 l_ctx dbms_xmlsave.ctxtype;
    4 rows number;
    5 begin
    6 insCtx := DBMS_XMLSave.newContext(tableName); -- get the context handle
    7 rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc); -- this inserts the document
    8 DBMS_XMLSave.closeContext(insCtx); -- this closes the handle
    9 end;
    10 /
    Procedure created.
    SQL> begin
    2 insProc('/usr/tmp/ROWSET.xml', 'emp');
    3 end;
    4 /
    begin
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException:
    Start of root element expected.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 65
    ORA-06512: at "SCOTT.INSPROC", line 7
    ORA-06512: at line 2
    Kishore B

  • How to set the servlet context path manually in Tomcat web server.

    I tested some servlets by putting them in the folder , which the tomcats examples application uses (ie Tomcat 4.1\webapps\examples\WEB-INF\classes\) and it appeared to be working fine.
    I was calling the servlet like this : http://localhost:2006/examples/servlet/TestServlet
    But when I installed my own WAR file in the server , the servlet is not working now. now the new location of my servlets is : Tomcat 4.1\webapps\MyApp\WEB-INF\classes\
    and I'm trying to call the servlet like this : http://localhost:2006/MyApp/servlet/TestServlet
    The error , what i'm getting is :
    description :The requested resource (/MyApp/servlet/TestServlet) is not available.
    Some body please tell where I'm making the mistake ? I believe this may have something to do with the servlet context path setting. If anybody has any idea , how to set the path..will be much appreciated.

    Thanx for your reply , at first I was not using any web.xml(since not mandatory) but even after using the web.xml file the error is coming . Please have a look into the contents of the web.xml file and let me know if you find any problem...
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>TestServlet</servlet-name>
    <servlet-class>TestServlet</servlet-class>
    </servlet>
    </web-app>
    one more thing I would like to tell you here. I was just looking into the configuration of Iplanet web server..I found that , there are options to set the servlet container path (like : - Prefix: /servlet
    Servlet Directory: /ecomm/iplanet/nes60/product/docs/container )
    so from here I came to know that "container " is the folder where we should put our servlets and it has URI as "servlet" but yet I'm not able to find any option in the Tomcat Web server to set the servlet container to any different directory.
    If you have any idea please let me know.

  • Set the path and class path in windows xp professional

    hi guys....could any one tell me step by step on how to set the path and classpath on windows xp professioanl? This is my path and classpath
    set path = %path%;C:\jdk1.3.1_02\bin;c:\JOpen672.jar;c:\
    set CLASSPATH = c:\j2sdkee1.3.1\lib\j2ee.jar;c:\JOpen672.Jar;c:\;c:\postgresql.jar;c:\jai_core.jar
    not working please help me on this thanks alot.
    novicepro

    Below is a Helloworld program, copy and paste it into your editor and save it as "HelloWorld.java" Use capitalization, Java is case-sensitive. If you're using Notepad, quote the name when saving, otherwise Notepad adds ".txt" to the name. Go to DOS and check that you've got the file where you want it and that it's named correctly.
    ----------program HelloWorld.java--------------
    public class HelloWorld {
    public static void main (String[] args) {
    System.out.println("Hello World!");
    In the same directory as HelloWorld.java, enter "javac" - the program should print out a list of options, if not, set your PATH - see below.
    In the same directory as HelloWorld.java, enter "javac HelloWorld.java" and the javac compiler will create HelloWorld.class. If it was successful it will not give any messages. Check that the file is created.
    In the same directory as HelloWorld.java, enter "java -cp . HelloWorld" with the spaces and the period. The program will run.
    Here is additional information:
    The Path is a set of pointers that Windows uses to locate programs that you execute, like javac.exe and java.exe. This setting is explained here:
    http://java.sun.com/j2se/1.4/install-windows.html
    Scroll down to: 5. Update the PATH variable
    (you should have already done this as part of the s/w installation)
    The CLASSPATH is another set of pointers that is used by Java to find the files that you create and want compiled and/or run. This setting is explained here:
    Setting the Classpath:
    http://java.sun.com/j2se/1.4/docs/tooldocs/windows/classpath.html
    [NOTE: always start your classpath with ".;" which means the current directory. See my classpath, below]
    How Classes are Found:
    http://java.sun.com/j2se/1.4/docs/tooldocs/findingclasses.html
    Examples:
    This is my path
    PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\BATCH;C:\J2SDK1.4.0_01\BIN;C:\PROGRA~1\UTILIT~1;C:\PROGRA~1\WIN98RK
    This is my classpath
    CLASSPATH=.;C:\mjava;C:\mnrx;C:\NetRexx\lib\NetRexxC.jar;C:\j2sdk1.4.0_1\lib\tools.jar;C:\NetRexx\NrxRedBk

  • To set the path

    Hi everyone,
    I am in the starting stage of java & i want to know how to set the path for java..i tried it but it giving an error ,so can please help me out in this..
    shubha

    Goto:
    http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html
    Here you will find instructions on setting the path among other info. Bad form using a Goto but I just cant resist :)

  • How to set the report path in a model plugin

    I am trying to figure out how to set the report path in a process model plug-in. I can seem to figure out how to get access to it. It seems like this would be a reasonable thing to do since the plug-ins are for results processing. Does anyone know how to do this? We typically use the Sequential process model but I am trying to keep my plug-in as independent of that as possible. 
    Thanks.
    Solved!
    Go to Solution.

    If I understand, you want your plug-in, when enabled, to alter the settings of any other instances of the NI report plug-in such that their reports share the same directory as your plug-in is configured to use.
    If so, your plug-in can access and modify the settings of all other plug-in instances. All instances are passed to all plug-in entries point in the plugins array sub-property of the ModelConfiguration parameter. You can iterate through this array. Any element of the array with a Base.SequenceFilename equal to "NI_ReportGenerator.seq" is an instance of the NI report plug-in. Its report options are stored in the element under PluginSpecific.Options.
    You can change the report options to what ever you want. Note that the ReportOptions model callback is called from the Initialize model-plugin entry point, so you might want to ensure that your changes are applied after that, so they aren't overwritten. To do that, you could make your changes in the the Initialize entry point of your plug-in, and ensure that your plugin runs last. To make it run last, you could set the FileGlobals.ModelPluginComponentDescription.Default.Base.RunOrder in your plug-in file to a value greater than 0, such as 1.0 (see TestStand Help>>Fundamentals>>Process Model Architecture>>Process Model Plug-in Architecture>>Structure of Plug-in Sequence Files>>Model Plug-in Entry Points>>Order of Entry Point Execution at Run Time).

  • How to set the File Path to run a javascript using Plugin Code?

    Hi All,
    Im new to Indesign Plugin Development.Can any one help me out with my problem.
    What i want to do is to run a javascript using Plugin Code.When i went through this forum i was able to find out that i should use the IscriptRunner Class to automate this.I could also figure out that the Member Function to use is "CanHandleFile" &"RunFile".
    The first parameter in CanHandleFile & RunFile Member Function is to specify the path of the JavaScript File i suppose!I could also find out that IDFile has to used to set the file path Information.
    But im clueless how to set the Javascript FilePath using IDFile.Can any one help me how to do this?Any Code Snippets Please?
    Waiting for reply.
    Thanks
    myRiaz

    Hi,  Andreas<br /><br />  Can you explain this in detail? I found it in your post before.<br /><br />  The content of elements are returned through the Characters callback function:<br /><br />From ISaxContentHandler.h:<br /><br />/**<br />        Receives character data<br /><br />The parser will call this method to report each chunk of<br />        character data. SAX parsers may return all contiguous<br />        character data in a single chunk, or they may split it into<br />        several chunks. But all characters in any single<br />        event must come from the same external entity so the<br />        Locator provides useful information.<br /><br />Note some parsers will report whitespace using the<br />        IgnorableWhitespace() method rather than this one (validating<br />        parsers must do so).<br /><br />@param Chars The characters from the XML document.<br />        */<br />virtual void Characters(const PMString& chars) = 0; <br /><br />  What i have done is implement my own SAXContentHandlerServiceBoss, and in my file XXXSAXContentHandler.cpp, I override the fonctions StartElement, EndElement, and Characters() like below: I add the PMString xmlData to collect the file content:<br /><br />class XXXSAXContentHandler : public CSAXContentHandler<br />{<br />void XXXSAXContentHandler::Characters(const WideString& chars)<br />{<br />xmlData.Append(chars);<br />}<br /><br />void XXXSAXContentHandler::StartElement(const WideString& uri, const WideString& localname, const WideString& qname, ISAXAttributes* attrs)<br />{<br />xmlData.Append("<"); xmlData.Append(localname); xmlData.Append(">");<br />}<br />void XXXSAXContentHandler::EndElement(const WideString& uri, const WideString& localname, const WideString& qname)<br />{<br />xmlData.Append("</"); xmlData.Append(localname); xmlData.Append(">");<br />}<br /><br />}<br /><br />and in my program, I use the code below to call the fonction I overrided, but I dont know how I can get the String xmlData I defined in the XXXSAXContentHandler.cpp<br /><br />InterfacePtr<IK2ServiceRegistry> serviceRegistry(gSession, UseDefaultIID());<br /><br />InterfacePtr<IK2ServiceProvider> xmlProvider(serviceRegistry->QueryServiceProviderByClassID(kXMLParserService, kXMLParserServiceBoss));<br /><br />InterfacePtr<ISAXServices> saxServices(xmlProvider, UseDefaultIID());<br />InterfacePtr<ISAXContentHandler> saxHandler(::CreateObject2<ISAXContentHandler>(kXXXSAXContentHandlerServiceBoss));<br />saxHandler->Register(saxServices);<br />bool16 parseFailed = saxServices->ParseStream(readStream, saxHandler);<br /><br />Can you give me any help?<br /><br />Thanks and regards!

  • How to set the file path dynamically based on sytem, username, and date

    Hi All,
    My requirement is upload the data into one  structure like xyz that is related to t.code MCSZ.
    file will be in  UNIx SERVER .
    PATH IS: /sapif
    file name is xy789 load .txt
    I have  to write code in one user-exit
    how can i set the file path for this.
    shall i put hard code file path?
    because i have to writecode in user-exit.
    plz tell me how to set the file path based ons syetem, username, date
    Thanks in advance
    Ram.A

    Concatenate the field SY-SYSID, SY-UNAME and SY-DATUM for the file path

  • How can I set the PATH properly in XP?

    Ive stuffed around for hours trying to do this. Ive installed j2eesdk-1_4_2004Q4-beta-windows.
    I wrote a simple app in jGrasp, then hit compile and it comes up with
    "package javax.ejb does not exist
    import javax.ejb.*;"
    Now my PATH looks something like this
    C:\Sun\AppServer\bin;C:\Sun\AppServer\jdk\bin;C:\Sun\AppServer\lib\j2ee.jar;
    this just doesnt work....
    Can someone who writes j2ee apps in XP plz let me know how to set up the class path so i dont get these package not found errors.
    It would be a great favour, thank you.
    PS when i move the j2ee.jar file into the jre\lib\ext folder it compiles, but this seems dodgy to me. Plz help me.

    Either set the classpath pointing to j2ee.jar when building your app (javac -classpath ...\j2ee.jar) - if you are using ant scripts to build, checkout the samples or blueprints applications for examples of how to set the classpath within ant scripts
    Or set your CLASSPATH environment to ...\j2ee.jar (My Computer->Control Panel->System->Advanced->Environment Variables
    Hope this helps

  • Sun ONE Studio 4 aka Forte: How to set the output path for classes ?

    Help !
    Beginner's question:
    Sun ONE Studio 4 aka Forte:
    How to set the output path for classes ?
    As default, the class files are created in the same directory as the
    sources.
    In opposite, both JBuilder and Together support that there is a tree
    with the sources and another tree with the classes.
    The first answer I got was "not possible with Forte, but just if you write your own "ANT Build script" !
    a) Please point me to a ready-to-use ANT script for this purpose, if such is available
    b) Is using ANT instead of the MAKE as comfortable ? Besides the separation of sourcecode and classes, I would like to keep everything else to be the same, i.e. I don�t want to edit the ANT file if I enlarge the project by directories or files.
    Tia
    Sincerely
    Rolf

    You can set S1S's options to place newly created .class files in a specific location.
    Identify the compiler that is being used - Open the S1S's Tools/Options window, expand Editing and select Java Sources. Note the Default Compiler value. (If it's one if the Ant options, you use Ant to specify this option, not S1S.)
    Open the S1S's Tools/Options window, expand Building/Compiler Types and select the appropriate compiler.
    The Properties tab of the compiler has the property Target, which sets the filesystem where the compiler output is directed. If you choose <not set>, the .class files are written to their source directory.
    When you set the Target, your change affects all classes that use this compiler.
    Very few options can't be set in S1S; the challenge is finding out where they're set!

  • How to set the default path of the tag while working with xtype "tags"

    Hi,
    I am working with xtype tag, where i have to select tags in the dialog box. Everything is fine, but my requirement is set the tags path.
    Currently it is defaulted to /etc/tags and showing all the tags. Instead i have show only the single tag path that is required for me.
    Is there any way where i can set the root path and set to my custom tag path like: /ets/tags/mycustomtags/
    Thanks for the support in advance
    Riyaz

    Hi,
    Use namespaces property to set the path. But it only works with namespaces that you directly creates under /etc/tags
    so for example if you want to use or show two namesapces /ets/tags/mycustomtags & /ets/tags/mycustomtags1
    then set this property as
    namespaces       string[]             mycustomtags  
                                                       mycustomtags1
    and if you have only want to show one then
    namespaces       string[]             mycustomtags
    I hope it will help you.
    Also refer http://dev.day.com/docs/en/cq/current/widgets-api/output/CQ.tagging.TagInputField.html
    Let me know if you need more information.
    THanks,
    Pawan

  • How to setting the root user profile?

    It seems that I can't fine any complet manual to introduce how to setting the root user profile file which locate at /etc/profile? Who can help me find out or figure it out

    first /etc/profile is a global profile for the system
    its not only specific to root
    from here you can configure the system wide paths
    Regardless of the shell you are using, when you first log in your system generally runs the system profile file, /etc/profile. This file is generally owned by the system administrator and is readable (but not writable) by all users.
    After your system executes the system profile, it runs the user profile. The user profile is one (or more) initialization files that define your working environment. For example, if you're in the CDE environment your system checks this file (or set of files) each time you start a new terminal or window.
    refer this::
    http://www.shrubbery.net/solaris9ab/SUNWabe/ADVOSUG/p33.html
    man page here
    http://www.unix.com/man-page/OpenSolaris/4/profile/

Maybe you are looking for

  • Not able to generate excel file locally

    Hi guys, My web server & database server are on 2 different systems. I am trying to generate excel file locally but the excel is getting generated on server. Output path is     c:\\" + output + ".xls    There is no problem anywhere else in code. If a

  • How do I delete photos from my photo library and a album that has come from iTunes

    I have sync photos from a folder, which I then decided I didn't want as I found them in my camera roll, now I want to delete the folder and the pics that are in pic library but for reason it's taking them off when I un click the folder then re sync t

  • Installed OS X 10.10 which slowed Late 2010 MacBookAir

    I've been scouring the Apple forums for tips to improve the performance of my Late 2010 MacBookAir. As many have experienced, after installing OS X 10.10 Yosemite, my MBA performance dropped to a crawl. Hanging up at time with the colorful swirl, slo

  • Language option or translation of af:Calendar

    Hi all, We are using af:calendar, it has text showing "Mon, Tues, Wed, ...". We want to convert it to local language, "Mongolian". Jdeveloper doesn't have a localization for Mongolian. So is there any way to translate this component? Jdev version : 1

  • VISA TCP/IP wait after query

    Hi  I found an issue with the driver to MSO-X 2014A TCP/IP scope which was sending the status request too early after the previous query was issued.  I have modified the vis, but I was wondering if there is a VISA property node which specifies the wa