bash - sac2xy not executable on terminal osx 10.9
2014-07
file sac2xy
sac2xy: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
ls -l sac2xy
-rwxrwxrwx 1 ravi staff 50334 Jun 12 11:22 sac2xy
file and ls -l sac2xy returns the above results
I come from using cygwin on Windows, and I just started using a mac. I'm wondering why it seems that search paths don't work like they should.
If I have a program in /usr/bin/prog
and I delete it. It seems to keep trying that exact path instead of searching for it again (let's say I move it to /usr/local/bin
).
Is this due to the terminal app or is it something specific to mac? Also, if I want to install a new version of python into /usr/local/bin
, is the right way to do it to remove it from /usr/bin/
?
You don't say which shell you're using, though your question is tagged with bash
. The default Mac OS X shell is If you're using tcsh or csh, they cache a table of items on your path. In order to refresh the table, issue the tcsh
, which rehash
command at the shell prompt.
You'll need to do this whenever you move or delete an executable, or if you add something to your path.
If you're really using the bash
shell then this doesn't apply.
OS X terminal will try the paths declared in your PATH variable, in order, until it finds it or runs out of places to check. You can check what your PATH variable is by typing the following at the command prompt:
echo $PATH
You can run the following from the command prompt to view where your shell is finding the program in question:
which prog
If you want to upgrade python, I recommend installing it to the same location as it already exists. If you want to have more than one version installed to your machine at a time, then installing it in /usr/local/bin would be a logical choice IMO.
From what I understand when you execute a program it will search the folders on your $PATH variable, which is separated by ":" eg.
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin
Is your $PATH set up correctly? To find this out use:
echo $PATH
You can also use which python to find which version and from where it is running. I believe this is also a left to right search so it will take the first program named python it finds on the path.