MAC terminal shell sh - file directory not recognized

MAC terminal shell sh - file directory not recognized


i have a few variations of MAC's when installing a package the shell sh is not recognizing the directory.


the path and the location have been updated during the installation but doesn't seem to be helping out with the installation progress.

Below image is what is seen on overall all the different versions



Did a search on other platforms to find out what is the possible reason but this has lead to another road block.


found that the .bash_profile / .zsh_profile is corrupted or deleted from the system.


recreated this and still am not able to resolve the issue ( - file directory not recognized)


Any advise on how this can be resolved to ensure that the shell recognizes the directory ???

Posted on Jun 7, 2023 4:57 AM

Reply
Question marked as Top-ranking reply

Posted on Jun 7, 2023 8:04 AM

The question mixes references to the POSIX shell sh and to zsh, which are disparate shells.


Which error are you encountering with the POSIX shell sh?


What is the script invocation command?


Which shell is specified in the shebang within the script?


If it's bash, the built-in version of bash on macOS is very old. Ancient.


For bash, using an add-on bash and the shebang #!/usr/bin/env bash might help things work better.


Might want to check with the package maintainers, too. Have they tested on macOS?


If you want us to look at the script and its error, you'll need to post that.

Similar questions

2 replies
Question marked as Top-ranking reply

Jun 7, 2023 8:04 AM in response to Baracudda_994

The question mixes references to the POSIX shell sh and to zsh, which are disparate shells.


Which error are you encountering with the POSIX shell sh?


What is the script invocation command?


Which shell is specified in the shebang within the script?


If it's bash, the built-in version of bash on macOS is very old. Ancient.


For bash, using an add-on bash and the shebang #!/usr/bin/env bash might help things work better.


Might want to check with the package maintainers, too. Have they tested on macOS?


If you want us to look at the script and its error, you'll need to post that.

Jun 7, 2023 8:24 AM in response to Baracudda_994

If you are implementing an install, you should be very careful about messing with a user's personalized shell initialization files.


First, because even if you know the shell the user is using, you cannot be sure with initialization file they are using. For example, the bash shell has .bash_profile, .bash_login and .profile. It will ONLY use one of them. If the user was using .profile, and you created .bash_profile, you would screw up the user's expected environment.


Also if you decide you are going to modify the PATH environment variable, where you choose to add that change may conflict with where the user is modifying PATH, and you might break the user's environment.


Anything you install using any shell, should NOT assume anything about the user's environment. And should if possible specify full path names for commands, so you do not accidentally invoke a different flavor of a command because the user has their own customizations.


Finally, when invoking sh via an install utility it may not even look at the user's shell initialization files, so anything you expect to find in a shell initialization file may not be present during your installation invocation of sh

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

MAC terminal shell sh - file directory not recognized

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.