Can't run one particular program from Terminal without using its full path












9















I want to run a program ds9 from the Terminal. The program is clearly in the PATH, which I determined by running:



which ds9
/Users/evgenii/miniconda3/envs/iraf/bin/ds9


But when I run the command by typingds9, it shows me the following error:



-bash: /Applications/ds9.app/Contents/MacOS/ds9: No such file or directory


I can still execute it fine if I use the full path as follows:



/Users/evgenii/miniconda3/envs/iraf/bin/ds9


What's going on? Why is it trying to run /Applications/ds9.app?



Permissions are as follows:



-rwxrwxr-x@ 1 evgenii  staff  18613852  9 Nov 20:13 /Users/evgenii/miniconda3/envs/iraf/bin/ds9


Update:



Here is the output of running type -a ds9 command:



type -a ds9
ds9 is aliased to `/Applications/ds9.app/Contents/MacOS/ds9 -xpa no'
ds9 is /Users/evgenii/miniconda3/envs/iraf/bin/ds9









share|improve this question




















  • 4





    Don't use which. It's an external program, so it can't tell about shell aliases.

    – Barmar
    Jan 9 at 23:23











  • Receipe to work with commands: use PATH rather than alias and type rather than which.

    – daniel Azuelos
    Jan 10 at 9:10
















9















I want to run a program ds9 from the Terminal. The program is clearly in the PATH, which I determined by running:



which ds9
/Users/evgenii/miniconda3/envs/iraf/bin/ds9


But when I run the command by typingds9, it shows me the following error:



-bash: /Applications/ds9.app/Contents/MacOS/ds9: No such file or directory


I can still execute it fine if I use the full path as follows:



/Users/evgenii/miniconda3/envs/iraf/bin/ds9


What's going on? Why is it trying to run /Applications/ds9.app?



Permissions are as follows:



-rwxrwxr-x@ 1 evgenii  staff  18613852  9 Nov 20:13 /Users/evgenii/miniconda3/envs/iraf/bin/ds9


Update:



Here is the output of running type -a ds9 command:



type -a ds9
ds9 is aliased to `/Applications/ds9.app/Contents/MacOS/ds9 -xpa no'
ds9 is /Users/evgenii/miniconda3/envs/iraf/bin/ds9









share|improve this question




















  • 4





    Don't use which. It's an external program, so it can't tell about shell aliases.

    – Barmar
    Jan 9 at 23:23











  • Receipe to work with commands: use PATH rather than alias and type rather than which.

    – daniel Azuelos
    Jan 10 at 9:10














9












9








9


1






I want to run a program ds9 from the Terminal. The program is clearly in the PATH, which I determined by running:



which ds9
/Users/evgenii/miniconda3/envs/iraf/bin/ds9


But when I run the command by typingds9, it shows me the following error:



-bash: /Applications/ds9.app/Contents/MacOS/ds9: No such file or directory


I can still execute it fine if I use the full path as follows:



/Users/evgenii/miniconda3/envs/iraf/bin/ds9


What's going on? Why is it trying to run /Applications/ds9.app?



Permissions are as follows:



-rwxrwxr-x@ 1 evgenii  staff  18613852  9 Nov 20:13 /Users/evgenii/miniconda3/envs/iraf/bin/ds9


Update:



Here is the output of running type -a ds9 command:



type -a ds9
ds9 is aliased to `/Applications/ds9.app/Contents/MacOS/ds9 -xpa no'
ds9 is /Users/evgenii/miniconda3/envs/iraf/bin/ds9









share|improve this question
















I want to run a program ds9 from the Terminal. The program is clearly in the PATH, which I determined by running:



which ds9
/Users/evgenii/miniconda3/envs/iraf/bin/ds9


But when I run the command by typingds9, it shows me the following error:



-bash: /Applications/ds9.app/Contents/MacOS/ds9: No such file or directory


I can still execute it fine if I use the full path as follows:



/Users/evgenii/miniconda3/envs/iraf/bin/ds9


What's going on? Why is it trying to run /Applications/ds9.app?



Permissions are as follows:



-rwxrwxr-x@ 1 evgenii  staff  18613852  9 Nov 20:13 /Users/evgenii/miniconda3/envs/iraf/bin/ds9


Update:



Here is the output of running type -a ds9 command:



type -a ds9
ds9 is aliased to `/Applications/ds9.app/Contents/MacOS/ds9 -xpa no'
ds9 is /Users/evgenii/miniconda3/envs/iraf/bin/ds9






terminal bash






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 10 at 8:46









Community

1




1










asked Jan 9 at 9:21









EvgeniiEvgenii

1486




1486








  • 4





    Don't use which. It's an external program, so it can't tell about shell aliases.

    – Barmar
    Jan 9 at 23:23











  • Receipe to work with commands: use PATH rather than alias and type rather than which.

    – daniel Azuelos
    Jan 10 at 9:10














  • 4





    Don't use which. It's an external program, so it can't tell about shell aliases.

    – Barmar
    Jan 9 at 23:23











  • Receipe to work with commands: use PATH rather than alias and type rather than which.

    – daniel Azuelos
    Jan 10 at 9:10








4




4





Don't use which. It's an external program, so it can't tell about shell aliases.

– Barmar
Jan 9 at 23:23





Don't use which. It's an external program, so it can't tell about shell aliases.

– Barmar
Jan 9 at 23:23













Receipe to work with commands: use PATH rather than alias and type rather than which.

– daniel Azuelos
Jan 10 at 9:10





Receipe to work with commands: use PATH rather than alias and type rather than which.

– daniel Azuelos
Jan 10 at 9:10










2 Answers
2






active

oldest

votes


















19














The command is apparently aliased to a broken alias. First, check for all the matches for ds9 in PATH environment variable, by executing the following command:



type -a ds9



As per your updated question, it's apparent from the output of type -a ds9 command, that an alias is shadowing the actual command.



To execute the actual command by ignoring the alias, and without specifying the full path, prepend a (backslash) character before the command. This ignores any bash defined alias.



If you do not wish to prepend the backslash before the command every time, figure out where the alias is being created, and either remove it, or override the alias with the actual command.






share|improve this answer





















  • 1





    The ds9 alias definition is most probably in ~/.bashrc and should be removed there (because it’s a bad method leading to this kind of problem). grep ds9 ~/.bashrc will confirm it.

    – daniel Azuelos
    Jan 10 at 9:02





















4














I see this was solved for the asker, but for future readers I want to mention that it could also be the case that the command was hashed and then the file removed. (See help hash for info.)



type -a commandname will not show you that, only type commandname will.



In this case, hash -d ds9 would be all that would be needed.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "118"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f348035%2fcant-run-one-particular-program-from-terminal-without-using-its-full-path%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    19














    The command is apparently aliased to a broken alias. First, check for all the matches for ds9 in PATH environment variable, by executing the following command:



    type -a ds9



    As per your updated question, it's apparent from the output of type -a ds9 command, that an alias is shadowing the actual command.



    To execute the actual command by ignoring the alias, and without specifying the full path, prepend a (backslash) character before the command. This ignores any bash defined alias.



    If you do not wish to prepend the backslash before the command every time, figure out where the alias is being created, and either remove it, or override the alias with the actual command.






    share|improve this answer





















    • 1





      The ds9 alias definition is most probably in ~/.bashrc and should be removed there (because it’s a bad method leading to this kind of problem). grep ds9 ~/.bashrc will confirm it.

      – daniel Azuelos
      Jan 10 at 9:02


















    19














    The command is apparently aliased to a broken alias. First, check for all the matches for ds9 in PATH environment variable, by executing the following command:



    type -a ds9



    As per your updated question, it's apparent from the output of type -a ds9 command, that an alias is shadowing the actual command.



    To execute the actual command by ignoring the alias, and without specifying the full path, prepend a (backslash) character before the command. This ignores any bash defined alias.



    If you do not wish to prepend the backslash before the command every time, figure out where the alias is being created, and either remove it, or override the alias with the actual command.






    share|improve this answer





















    • 1





      The ds9 alias definition is most probably in ~/.bashrc and should be removed there (because it’s a bad method leading to this kind of problem). grep ds9 ~/.bashrc will confirm it.

      – daniel Azuelos
      Jan 10 at 9:02
















    19












    19








    19







    The command is apparently aliased to a broken alias. First, check for all the matches for ds9 in PATH environment variable, by executing the following command:



    type -a ds9



    As per your updated question, it's apparent from the output of type -a ds9 command, that an alias is shadowing the actual command.



    To execute the actual command by ignoring the alias, and without specifying the full path, prepend a (backslash) character before the command. This ignores any bash defined alias.



    If you do not wish to prepend the backslash before the command every time, figure out where the alias is being created, and either remove it, or override the alias with the actual command.






    share|improve this answer















    The command is apparently aliased to a broken alias. First, check for all the matches for ds9 in PATH environment variable, by executing the following command:



    type -a ds9



    As per your updated question, it's apparent from the output of type -a ds9 command, that an alias is shadowing the actual command.



    To execute the actual command by ignoring the alias, and without specifying the full path, prepend a (backslash) character before the command. This ignores any bash defined alias.



    If you do not wish to prepend the backslash before the command every time, figure out where the alias is being created, and either remove it, or override the alias with the actual command.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jan 10 at 15:21









    Allan

    43.6k1465165




    43.6k1465165










    answered Jan 9 at 9:46









    Nimesh NeemaNimesh Neema

    14.4k54175




    14.4k54175








    • 1





      The ds9 alias definition is most probably in ~/.bashrc and should be removed there (because it’s a bad method leading to this kind of problem). grep ds9 ~/.bashrc will confirm it.

      – daniel Azuelos
      Jan 10 at 9:02
















    • 1





      The ds9 alias definition is most probably in ~/.bashrc and should be removed there (because it’s a bad method leading to this kind of problem). grep ds9 ~/.bashrc will confirm it.

      – daniel Azuelos
      Jan 10 at 9:02










    1




    1





    The ds9 alias definition is most probably in ~/.bashrc and should be removed there (because it’s a bad method leading to this kind of problem). grep ds9 ~/.bashrc will confirm it.

    – daniel Azuelos
    Jan 10 at 9:02







    The ds9 alias definition is most probably in ~/.bashrc and should be removed there (because it’s a bad method leading to this kind of problem). grep ds9 ~/.bashrc will confirm it.

    – daniel Azuelos
    Jan 10 at 9:02















    4














    I see this was solved for the asker, but for future readers I want to mention that it could also be the case that the command was hashed and then the file removed. (See help hash for info.)



    type -a commandname will not show you that, only type commandname will.



    In this case, hash -d ds9 would be all that would be needed.






    share|improve this answer




























      4














      I see this was solved for the asker, but for future readers I want to mention that it could also be the case that the command was hashed and then the file removed. (See help hash for info.)



      type -a commandname will not show you that, only type commandname will.



      In this case, hash -d ds9 would be all that would be needed.






      share|improve this answer


























        4












        4








        4







        I see this was solved for the asker, but for future readers I want to mention that it could also be the case that the command was hashed and then the file removed. (See help hash for info.)



        type -a commandname will not show you that, only type commandname will.



        In this case, hash -d ds9 would be all that would be needed.






        share|improve this answer













        I see this was solved for the asker, but for future readers I want to mention that it could also be the case that the command was hashed and then the file removed. (See help hash for info.)



        type -a commandname will not show you that, only type commandname will.



        In this case, hash -d ds9 would be all that would be needed.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 9 at 20:25









        WildcardWildcard

        722519




        722519






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Different!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f348035%2fcant-run-one-particular-program-from-terminal-without-using-its-full-path%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

            How to fix TextFormField cause rebuild widget in Flutter