By Evgenii


2019-01-09 09:21:07 8 Comments

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:

[email protected] 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

2 comments

@Nimesh Neema 2019-01-09 09:46:18

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.

@daniel Azuelos 2019-01-10 09:02:30

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.

@Wildcard 2019-01-09 20:25:39

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.

Related Questions

Sponsored Content

2 Answered Questions

[SOLVED] Difference between two quite-similar Terminal commands

3 Answered Questions

[SOLVED] "bash" command runs scripts in version 3.2, not 4.4

  • 2018-11-16 20:00:55
  • De Novo
  • 192 View
  • 2 Score
  • 3 Answer
  • Tags:   terminal bash

2 Answered Questions

[SOLVED] How can I run an app, when using the full path?

  • 2018-09-20 08:20:54
  • user3776738
  • 30 View
  • 1 Score
  • 2 Answer
  • Tags:   mac bash

2 Answered Questions

[SOLVED] cron and "command not found"

1 Answered Questions

[SOLVED] How to make command run in terminal? Command not found

  • 2016-11-24 05:11:19
  • mimic
  • 2873 View
  • 4 Score
  • 1 Answer
  • Tags:   macbook terminal

1 Answered Questions

[SOLVED] terminal -bash: command not found

1 Answered Questions

[SOLVED] Concatenating date and cycle count to file on startup

2 Answered Questions

[SOLVED] Characters do not echo in OS X terminal unless I hit the delete key

  • 2014-06-19 03:45:09
  • user3749625
  • 960 View
  • 3 Score
  • 2 Answer
  • Tags:   macos bash

1 Answered Questions

Sponsored Content